<commit_before><%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ page contentType="text/html;charset=windows-1252"%>

<%@ page import="java.io.*" %>
<%@ page import="java.util.*"%>
<%@ page import="java.util.Vector"%>
<%@ page import="java.util.HashMap"%>
<%@ page import="java.util.List"%>

<%@ page import="org.LexGrid.concepts.Entity" %>
<%@ page import="gov.nih.nci.evs.browser.common.Constants" %>
<%@ page import="gov.nih.nci.evs.browser.utils.DataUtils" %>
<%@ page import="gov.nih.nci.evs.browser.utils.HTTPUtils" %>

<%@ page import="gov.nih.nci.evs.browser.bean.MappingIteratorBean" %>
<%@ page import="gov.nih.nci.evs.browser.bean.MappingData" %>
<%@ page import="org.LexGrid.LexBIG.DataModel.Core.ResolvedConceptReference" %>
<%@ page import="org.LexGrid.LexBIG.Utility.Iterators.ResolvedConceptReferencesIterator" %>

<%@ page import="gov.nih.nci.evs.browser.bean.*" %>
<%@ page import="gov.nih.nci.evs.browser.utils.*" %>
<%@ page import="gov.nih.nci.evs.browser.properties.*" %>
<%@ page import="javax.faces.context.FacesContext" %>
<%@ page import="org.apache.log4j.*" %>


<%@ page import="org.LexGrid.LexBIG.Extensions.Generic.MappingExtension.Mapping.SearchContext" %>




<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html xmlns:c="http://java.sun.com/jsp/jstl/core">
<head>
  <title>NCI Thesaurus</title>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  <link rel="stylesheet" type="text/css" href="<%= request.getContextPath() %>/css/styleSheet.css" />
  <link rel="shortcut icon" href="<%= request.getContextPath() %>/favicon.ico" type="image/x-icon" />
  <script type="text/javascript" src="<%= request.getContextPath() %>/js/script.js"></script>
  <script type="text/javascript" src="<%= request.getContextPath() %>/js/search.js"></script>
  <script type="text/javascript" src="<%= request.getContextPath() %>/js/dropdown.js"></script>
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
  <script type="text/javascript" src="<%= request.getContextPath() %>/js/wz_tooltip.js"></script>
  <script type="text/javascript" src="<%= request.getContextPath() %>/js/tip_centerwindow.js"></script>
  <script type="text/javascript" src="<%= request.getContextPath() %>/js/tip_followscroll.js"></script>
<%!
  private static Logger _logger = Utils.getJspLogger("mapping-search_results.jsp");
%>

<f:view>
  <!-- Begin Skip Top Navigation -->
    <a href="#evs-content" class="hideLink" accesskey="1" title="Skip repetitive navigation links">skip navigation links</A>
  <!-- End Skip Top Navigation -->
  <%@ include file="/pages/templates/header.jsp" %>
  <div class="center-page">
    <%@ include file="/pages/templates/sub-header.jsp" %>
    <!-- Main box -->
    <div id="main-area">
<%

HashMap display_name_hmap = new HashMap();

HashMap scheme2MappingIteratorBeanMap = null;
ResolvedConceptReferencesIterator iterator = null;
MappingIteratorBean bean = null;

JSPUtils.JSPHeaderInfo info = new JSPUtils.JSPHeaderInfo(request);
String mapping_scheme = info.dictionary;
String mapping_dictionary = info.dictionary;
String mapping_version = info.version;

System.out.println("(*) mapping_search_results.jsp dictionary: " + mapping_dictionary);
System.out.println("(*) mapping_search_results.jsp version: " + mapping_version);
_logger.debug("mapping_search_results.jsp dictionary: " + mapping_dictionary);
_logger.debug("mapping_search_results.jsp version: " + mapping_version);

 String mapping_display_name =
                DataUtils
                    .getMetadataValue(mapping_dictionary, mapping_version, "display_name");
                    
 String mapping_term_browser_version =
                DataUtils.getMetadataValue(mapping_dictionary, mapping_version,
                    "term_browser_version");
%>


 
 <div class="bannerarea">
 
     <a class="vocabularynamebanner" href="<%=request.getContextPath()%>/pages/vocabulary.jsf?dictionary=<%=HTTPUtils.cleanXSS(mapping_dictionary)%>">
       <div class="vocabularynamebanner">
           <div class="vocabularynameshort" STYLE="font-size: <%=HTTPUtils.maxFontSize(mapping_display_name)%>px; font-family : Arial">
             <%=HTTPUtils.cleanXSS(mapping_display_name)%>
           </div>
           <div class="vocabularynamelong">Version:&nbsp;<%=HTTPUtils.cleanXSS(mapping_term_browser_version)%>
           </div>
        </div>
     </a>

         
	 <div class="search-globalnav"><!-- Search box -->
		 <div class="searchbox-top"><img
		   src="<%=basePath%>/images/searchbox-top.gif" width="352" height="2"
		   alt="SearchBox Top" /></div>
	 	<div class="searchbox"><%@ include file="/pages/templates/searchForm.jsp"%></div>
	 
		 <div class="searchbox-bottom"><img
		   src="<%=basePath%>/images/searchbox-bottom.gif" width="352" height="2"
		   alt="SearchBox Bottom" /></div>
		 <!-- end Search box --> <!-- Global Navigation --> <%@ include
		   file="/pages/templates/menuBar-termbrowserhome.jsp"%> <!-- end Global Navigation -->
	 </div>
 </div>
 <!-- end Thesaurus, banner search area -->
 <!-- Quick links bar -->
 <%@ include file="/pages/templates/quickLink.jsp"%>
<!-- end Quick links bar -->



      
      
      <!-- Page content -->
      <div class="pagecontent">
	    <a name="evs-content" id="evs-content"></a>


<%
String mapping_results_msg = (String) request.getSession().getAttribute("message");
if (mapping_results_msg != null) {
    request.getSession().removeAttribute("message");
    
    
      %>
      <p class="textbodyred"><%=mapping_results_msg%></p>
      <%
      
} else {    


String resultsPerPage = request.getParameter("resultsPerPage");
if (resultsPerPage == null) {
    resultsPerPage = "50";
}

String selectedResultsPerPage = resultsPerPage;


String base_path = request.getContextPath();
int numRemaining = 0;


String key = (String) request.getAttribute("key");
System.out.println("(++++++++++++++++++++) search results.jsp key: " + key);
if (key == null) {
    key = HTTPUtils.cleanXSS((String) request.getParameter("key"));
}


//IteratorBeanManager iteratorBeanManager = (IteratorBeanManager) FacesContext.getCurrentInstance().getExternalContext()
//.getSessionMap().get("iteratorBeanManager");


MappingIteratorBean mapping_bean = (MappingIteratorBean) request.getSession().getAttribute("mapping_search_results");


int pageSize = Integer.parseInt(selectedResultsPerPage);
int size = 0;
int pageNum = 1;

if (mapping_bean != null) {
	size = mapping_bean.getSize();
}

List list = null;
int num_pages = size / pageSize;
if (num_pages * pageSize < size) num_pages++;
System.out.println("num_pages: " + num_pages);

String page_number = HTTPUtils.cleanXSS((String) request.getParameter("page_number"));
if (page_number != null) {
    pageNum = Integer.parseInt(page_number);
}
System.out.println("pageNum: " + pageNum);

int istart = pageNum * pageSize;

int page_num = pageNum;
if (page_num == 0) {
    page_num++;
} else {
    istart = (pageNum-1) * pageSize;
}


System.out.println( "(*) pageSize: " + pageSize);


int iend = istart + pageSize - 1;

System.out.println( "(*) iend: " + iend);




try {
   list = mapping_bean.getData(istart, iend);
   int prev_size = size;
   size = mapping_bean.getSize();
   
System.out.println( "(*) prev_size: " + prev_size);
System.out.println( "(*) size: " + size);


   if (size != prev_size) {
   /*
       if (iend > istart + pageSize -1) {
           iend = istart + pageSize -1;
       } 
       if (size > istart + pageSize -1) {
           iend = istart + pageSize -1;
       }
   */

	if (iend > size) {
	    iend = size;
	}

   
       //KLO
       list = mapping_bean.getData(istart, size);
       
   } else {

	if (iend > size) {
	    iend = size;
	}

   }


} catch (Exception ex) {
   System.out.println("ERROR: bean.getData throws exception??? istart: " + istart + " iend: " + iend);
}


num_pages = size / pageSize;
if (num_pages * pageSize < size) num_pages++;

System.out.println("num_pages: " + num_pages);


System.out.println("\npage_num: " + page_num); //0
System.out.println("size: " + size); //85
System.out.println("pageSize: " + pageSize); //50



System.out.println("(**************** iend: " + iend);

System.out.println("(**************** page_num: " + page_num);





System.out.println("exiting bean.getData ...");

boolean show_rank_column = true;
String map_rank_applicable = DataUtils.getMetadataValue(mapping_scheme, mapping_version, "map_rank_applicable");
if (map_rank_applicable != null && map_rank_applicable.compareTo("false") == 0) {
    show_rank_column = false;
}

%>
          <table class="datatable">

          <th class="dataTableHeader" width="60px" scope="col" align="left">Source</th>


          <th class="dataTableHeader" scope="col" align="left">
                 Source Code
          </th>

          <th class="dataTableHeader" scope="col" align="left">
                 Source Name
          </th>

          <th class="dataTableHeader" width="30px" scope="col" align="left">
                 REL
          </th>

<%
if (show_rank_column) {
%>
          <th class="dataTableHeader" width="35px" scope="col" align="left">
                 Map Rank
          </th>
<%
}
%>

          <th class="dataTableHeader" width="60px" scope="col" align="left">Target</th>

          <th class="dataTableHeader" scope="col" align="left">
                 Target Code
          </th>

          <th class="dataTableHeader" scope="col" align="left">
                 Target Name
          </th>


            <%
                String source_scheme = null;//"NCI_Thesaurus";
                String source_version = null;// "10.06e";
                String source_namespace = null;
                String target_scheme = null;// "ICD_9_CM";
                String target_version = null;// "2010";

                String source_code = null;
                String source_name = null;
                String rel = null;
                String score = null;
                String target_code = null;
                String target_name = null;
                String target_namespace = null;
                MappingData mappingData = null;


 if (list == null) {
  System.out.println("list == null???");
 } else {

                //for (int lcv=0; lcv<list.size(); lcv++) {
                
 int upper_bound = list.size();
 if (upper_bound > pageSize) {
     upper_bound = pageSize;
     
 }
 
 
 System.out.println("(**************** list.size(): " + list.size());
 
 System.out.println("(**************** upper_bound: " + upper_bound);
 
  System.out.println("(**************** istart: " + istart);
  
  System.out.println("(**************** iend: " + iend);
 
                
                for (int lcv=0; lcv<upper_bound; lcv++) {
                    mappingData = (MappingData) list.get(lcv);
        source_code = mappingData.getSourceCode();
        source_name = mappingData.getSourceName();
        source_namespace = mappingData.getSourceCodeNamespace();

        if (display_name_hmap.containsKey(source_namespace)) {
            source_namespace = (String) display_name_hmap.get(source_namespace);
        } else {
            String short_name = DataUtils.getMappingDisplayName(mapping_dictionary, source_namespace);
            display_name_hmap.put(source_namespace, short_name);
            source_namespace = short_name;
        }

        rel = mappingData.getRel();
        score = new Integer(mappingData.getScore()).toString();
        target_code = mappingData.getTargetCode();
        target_name = mappingData.getTargetName();
        target_namespace = mappingData.getTargetCodeNamespace();

        if (display_name_hmap.containsKey(target_namespace)) {
            target_namespace = (String) display_name_hmap.get(target_namespace);
        } else {
            String short_name = DataUtils.getMappingDisplayName(mapping_dictionary, target_namespace);
            display_name_hmap.put(target_namespace, short_name);
            target_namespace = short_name;
        }  
        
        source_scheme = mappingData.getSourceCodingScheme();
        source_version = mappingData.getSourceCodingSchemeVersion();
        target_scheme = mappingData.getTargetCodingScheme();
        target_version = mappingData.getTargetCodingSchemeVersion();
       
                
source_scheme = DataUtils.getFormalName(source_scheme);        
target_scheme = DataUtils.getFormalName(target_scheme);        

            %>

<tr>
                    <td class="datacoldark"><%=source_namespace%></td>
        <td class="datacoldark">
<a href="#"
      onclick="javascript:window.location='<%= request.getContextPath() %>/ConceptReport.jsp?dictionary=<%=source_scheme%>&version=<%=source_version%>&code=<%=source_code%>'">
      <%=source_code%>
</a>


        </td>
        <td class="datacoldark"><%=source_name%></td>


        <td class="textbody"><%=rel%></td>
        
<%
if (show_rank_column) {
%>        
        <td class="textbody"><%=score%></td>
<%
}
%>


        <td class="datacoldark"><%=target_namespace%></td>
        <td class="datacoldark">

<a href="#"
      onclick="javascript:window.location='<%= request.getContextPath() %>/ConceptReport.jsp?dictionary=<%=target_scheme%>&version=<%=target_version%>&code=<%=target_code%>'">
      <%=target_code%>
</a>


                    </td>
        <td class="datacoldark"><%=target_name%></td>

</tr>

               <%
               }
}
               %>


          </table>

        <%@ include file="/pages/templates/pagination-mapping-results.jsp" %>
        
 <%       
 }       
 %>       
        
        
        <%@ include file="/pages/templates/nciFooter.jsp" %>
      </div>
      <!-- end Page content -->
    </div>
    <div class="mainbox-bottom"><img src="<%=basePath%>/images/mainbox-bottom.gif" width="745" height="5" alt="Mainbox Bottom" /></div>
    <!-- end Main box -->
  </div>
</f:view>
</body>
</html>

<commit_msg>[GF#31215] Mapping search results page has incorrect results listing when results per page is changed. [KLO, 050911]<commit_after><%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ page contentType="text/html;charset=windows-1252"%>

<%@ page import="java.io.*" %>
<%@ page import="java.util.*"%>
<%@ page import="java.util.Vector"%>
<%@ page import="java.util.HashMap"%>
<%@ page import="java.util.List"%>

<%@ page import="org.LexGrid.concepts.Entity" %>
<%@ page import="gov.nih.nci.evs.browser.common.Constants" %>
<%@ page import="gov.nih.nci.evs.browser.utils.DataUtils" %>
<%@ page import="gov.nih.nci.evs.browser.utils.HTTPUtils" %>

<%@ page import="gov.nih.nci.evs.browser.bean.MappingIteratorBean" %>
<%@ page import="gov.nih.nci.evs.browser.bean.MappingData" %>
<%@ page import="org.LexGrid.LexBIG.DataModel.Core.ResolvedConceptReference" %>
<%@ page import="org.LexGrid.LexBIG.Utility.Iterators.ResolvedConceptReferencesIterator" %>

<%@ page import="gov.nih.nci.evs.browser.bean.*" %>
<%@ page import="gov.nih.nci.evs.browser.utils.*" %>
<%@ page import="gov.nih.nci.evs.browser.properties.*" %>
<%@ page import="javax.faces.context.FacesContext" %>
<%@ page import="org.apache.log4j.*" %>


<%@ page import="org.LexGrid.LexBIG.Extensions.Generic.MappingExtension.Mapping.SearchContext" %>




<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html xmlns:c="http://java.sun.com/jsp/jstl/core">
<head>
  <title>NCI Thesaurus</title>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  <link rel="stylesheet" type="text/css" href="<%= request.getContextPath() %>/css/styleSheet.css" />
  <link rel="shortcut icon" href="<%= request.getContextPath() %>/favicon.ico" type="image/x-icon" />
  <script type="text/javascript" src="<%= request.getContextPath() %>/js/script.js"></script>
  <script type="text/javascript" src="<%= request.getContextPath() %>/js/search.js"></script>
  <script type="text/javascript" src="<%= request.getContextPath() %>/js/dropdown.js"></script>
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
  <script type="text/javascript" src="<%= request.getContextPath() %>/js/wz_tooltip.js"></script>
  <script type="text/javascript" src="<%= request.getContextPath() %>/js/tip_centerwindow.js"></script>
  <script type="text/javascript" src="<%= request.getContextPath() %>/js/tip_followscroll.js"></script>
<%!
  private static Logger _logger = Utils.getJspLogger("mapping-search_results.jsp");
%>

<f:view>
  <!-- Begin Skip Top Navigation -->
    <a href="#evs-content" class="hideLink" accesskey="1" title="Skip repetitive navigation links">skip navigation links</A>
  <!-- End Skip Top Navigation -->
  <%@ include file="/pages/templates/header.jsp" %>
  <div class="center-page">
    <%@ include file="/pages/templates/sub-header.jsp" %>
    <!-- Main box -->
    <div id="main-area">
<%

HashMap display_name_hmap = new HashMap();

HashMap scheme2MappingIteratorBeanMap = null;
ResolvedConceptReferencesIterator iterator = null;
MappingIteratorBean bean = null;

JSPUtils.JSPHeaderInfo info = new JSPUtils.JSPHeaderInfo(request);
String mapping_scheme = info.dictionary;
String mapping_dictionary = info.dictionary;
String mapping_version = info.version;

System.out.println("(*) mapping_search_results.jsp dictionary: " + mapping_dictionary);
System.out.println("(*) mapping_search_results.jsp version: " + mapping_version);
_logger.debug("mapping_search_results.jsp dictionary: " + mapping_dictionary);
_logger.debug("mapping_search_results.jsp version: " + mapping_version);

 String mapping_display_name =
                DataUtils
                    .getMetadataValue(mapping_dictionary, mapping_version, "display_name");
                    
 String mapping_term_browser_version =
                DataUtils.getMetadataValue(mapping_dictionary, mapping_version,
                    "term_browser_version");
%>


 
 <div class="bannerarea">
 
     <a class="vocabularynamebanner" href="<%=request.getContextPath()%>/pages/vocabulary.jsf?dictionary=<%=HTTPUtils.cleanXSS(mapping_dictionary)%>">
       <div class="vocabularynamebanner">
           <div class="vocabularynameshort" STYLE="font-size: <%=HTTPUtils.maxFontSize(mapping_display_name)%>px; font-family : Arial">
             <%=HTTPUtils.cleanXSS(mapping_display_name)%>
           </div>
           <div class="vocabularynamelong">Version:&nbsp;<%=HTTPUtils.cleanXSS(mapping_term_browser_version)%>
           </div>
        </div>
     </a>

         
	 <div class="search-globalnav"><!-- Search box -->
		 <div class="searchbox-top"><img
		   src="<%=basePath%>/images/searchbox-top.gif" width="352" height="2"
		   alt="SearchBox Top" /></div>
	 	<div class="searchbox"><%@ include file="/pages/templates/searchForm.jsp"%></div>
	 
		 <div class="searchbox-bottom"><img
		   src="<%=basePath%>/images/searchbox-bottom.gif" width="352" height="2"
		   alt="SearchBox Bottom" /></div>
		 <!-- end Search box --> <!-- Global Navigation --> <%@ include
		   file="/pages/templates/menuBar-termbrowserhome.jsp"%> <!-- end Global Navigation -->
	 </div>
 </div>
 <!-- end Thesaurus, banner search area -->
 <!-- Quick links bar -->
 <%@ include file="/pages/templates/quickLink.jsp"%>
<!-- end Quick links bar -->



      
      
      <!-- Page content -->
      <div class="pagecontent">
	    <a name="evs-content" id="evs-content"></a>


<%
String mapping_results_msg = (String) request.getSession().getAttribute("message");
if (mapping_results_msg != null) {
    request.getSession().removeAttribute("message");
    
    
      %>
      <p class="textbodyred"><%=mapping_results_msg%></p>
      <%
      
} else {    


String resultsPerPage = (String) request.getParameter("resultsPerPage");
if (resultsPerPage == null) {
    resultsPerPage = (String) request.getSession().getAttribute("resultsPerPage");
    if (resultsPerPage == null) {
        resultsPerPage = "50";
    }
    
}  else {
    request.getSession().setAttribute("resultsPerPage", resultsPerPage);
}



String selectedResultsPerPage = resultsPerPage;


String base_path = request.getContextPath();
int numRemaining = 0;


String key = (String) request.getAttribute("key");
System.out.println("(++++++++++++++++++++) search results.jsp key: " + key);
if (key == null) {
    key = HTTPUtils.cleanXSS((String) request.getParameter("key"));
}


//IteratorBeanManager iteratorBeanManager = (IteratorBeanManager) FacesContext.getCurrentInstance().getExternalContext()
//.getSessionMap().get("iteratorBeanManager");


MappingIteratorBean mapping_bean = (MappingIteratorBean) request.getSession().getAttribute("mapping_search_results");


int pageSize = Integer.parseInt(selectedResultsPerPage);
int size = 0;
int pageNum = 1;

if (mapping_bean != null) {
	size = mapping_bean.getSize();
}

List list = null;
int num_pages = size / pageSize;
if (num_pages * pageSize < size) num_pages++;
System.out.println("num_pages: " + num_pages);

String page_number = HTTPUtils.cleanXSS((String) request.getParameter("page_number"));
if (page_number != null) {
    pageNum = Integer.parseInt(page_number);
}
System.out.println("pageNum: " + pageNum);

int istart = pageNum * pageSize;

int page_num = pageNum;
if (page_num == 0) {
    page_num++;
} else {
    istart = (pageNum-1) * pageSize;
}


System.out.println( "(*) pageSize: " + pageSize);


int iend = istart + pageSize - 1;

System.out.println( "(*) iend: " + iend);




try {
   list = mapping_bean.getData(istart, iend);
   int prev_size = size;
   size = mapping_bean.getSize();
   
System.out.println( "(*) prev_size: " + prev_size);
System.out.println( "(*) size: " + size);


   if (size != prev_size) {
   /*
       if (iend > istart + pageSize -1) {
           iend = istart + pageSize -1;
       } 
       if (size > istart + pageSize -1) {
           iend = istart + pageSize -1;
       }
   */

	if (iend > size) {
	    iend = size;
	}

   
       //KLO
       list = mapping_bean.getData(istart, size);
       
   } else {

	if (iend > size) {
	    iend = size;
	}

   }


} catch (Exception ex) {
   System.out.println("ERROR: bean.getData throws exception??? istart: " + istart + " iend: " + iend);
}


num_pages = size / pageSize;
if (num_pages * pageSize < size) num_pages++;

System.out.println("num_pages: " + num_pages);


System.out.println("\npage_num: " + page_num); //0
System.out.println("size: " + size); //85
System.out.println("pageSize: " + pageSize); //50



System.out.println("(**************** iend: " + iend);

System.out.println("(**************** page_num: " + page_num);





System.out.println("exiting bean.getData ...");

boolean show_rank_column = true;
String map_rank_applicable = DataUtils.getMetadataValue(mapping_scheme, mapping_version, "map_rank_applicable");
if (map_rank_applicable != null && map_rank_applicable.compareTo("false") == 0) {
    show_rank_column = false;
}

%>
          <table class="datatable">

          <th class="dataTableHeader" width="60px" scope="col" align="left">Source</th>


          <th class="dataTableHeader" scope="col" align="left">
                 Source Code
          </th>

          <th class="dataTableHeader" scope="col" align="left">
                 Source Name
          </th>

          <th class="dataTableHeader" width="30px" scope="col" align="left">
                 REL
          </th>

<%
if (show_rank_column) {
%>
          <th class="dataTableHeader" width="35px" scope="col" align="left">
                 Map Rank
          </th>
<%
}
%>

          <th class="dataTableHeader" width="60px" scope="col" align="left">Target</th>

          <th class="dataTableHeader" scope="col" align="left">
                 Target Code
          </th>

          <th class="dataTableHeader" scope="col" align="left">
                 Target Name
          </th>


            <%
                String source_scheme = null;//"NCI_Thesaurus";
                String source_version = null;// "10.06e";
                String source_namespace = null;
                String target_scheme = null;// "ICD_9_CM";
                String target_version = null;// "2010";

                String source_code = null;
                String source_name = null;
                String rel = null;
                String score = null;
                String target_code = null;
                String target_name = null;
                String target_namespace = null;
                MappingData mappingData = null;


 if (list == null) {
  System.out.println("list == null???");
 } else {

                //for (int lcv=0; lcv<list.size(); lcv++) {
                
 int upper_bound = list.size();
 if (upper_bound > pageSize) {
     upper_bound = pageSize;
     
 }
 
 
 System.out.println("(**************** list.size(): " + list.size());
 
 System.out.println("(**************** upper_bound: " + upper_bound);
 
  System.out.println("(**************** istart: " + istart);
  
  System.out.println("(**************** iend: " + iend);
 
                
                for (int lcv=0; lcv<upper_bound; lcv++) {
                    mappingData = (MappingData) list.get(lcv);
        source_code = mappingData.getSourceCode();
        source_name = mappingData.getSourceName();
        source_namespace = mappingData.getSourceCodeNamespace();

        if (display_name_hmap.containsKey(source_namespace)) {
            source_namespace = (String) display_name_hmap.get(source_namespace);
        } else {
            String short_name = DataUtils.getMappingDisplayName(mapping_dictionary, source_namespace);
            display_name_hmap.put(source_namespace, short_name);
            source_namespace = short_name;
        }

        rel = mappingData.getRel();
        score = new Integer(mappingData.getScore()).toString();
        target_code = mappingData.getTargetCode();
        target_name = mappingData.getTargetName();
        target_namespace = mappingData.getTargetCodeNamespace();

        if (display_name_hmap.containsKey(target_namespace)) {
            target_namespace = (String) display_name_hmap.get(target_namespace);
        } else {
            String short_name = DataUtils.getMappingDisplayName(mapping_dictionary, target_namespace);
            display_name_hmap.put(target_namespace, short_name);
            target_namespace = short_name;
        }  
        
        source_scheme = mappingData.getSourceCodingScheme();
        source_version = mappingData.getSourceCodingSchemeVersion();
        target_scheme = mappingData.getTargetCodingScheme();
        target_version = mappingData.getTargetCodingSchemeVersion();
       
                
source_scheme = DataUtils.getFormalName(source_scheme);        
target_scheme = DataUtils.getFormalName(target_scheme);        

            %>

<tr>
                    <td class="datacoldark"><%=source_namespace%></td>
        <td class="datacoldark">
<a href="#"
      onclick="javascript:window.location='<%= request.getContextPath() %>/ConceptReport.jsp?dictionary=<%=source_scheme%>&version=<%=source_version%>&code=<%=source_code%>'">
      <%=source_code%>
</a>


        </td>
        <td class="datacoldark"><%=source_name%></td>


        <td class="textbody"><%=rel%></td>
        
<%
if (show_rank_column) {
%>        
        <td class="textbody"><%=score%></td>
<%
}
%>


        <td class="datacoldark"><%=target_namespace%></td>
        <td class="datacoldark">

<a href="#"
      onclick="javascript:window.location='<%= request.getContextPath() %>/ConceptReport.jsp?dictionary=<%=target_scheme%>&version=<%=target_version%>&code=<%=target_code%>'">
      <%=target_code%>
</a>


                    </td>
        <td class="datacoldark"><%=target_name%></td>

</tr>

               <%
               }
}
               %>


          </table>

        <%@ include file="/pages/templates/pagination-mapping-results.jsp" %>
        
 <%       
 }       
 %>       
        
        
        <%@ include file="/pages/templates/nciFooter.jsp" %>
      </div>
      <!-- end Page content -->
    </div>
    <div class="mainbox-bottom"><img src="<%=basePath%>/images/mainbox-bottom.gif" width="745" height="5" alt="Mainbox Bottom" /></div>
    <!-- end Main box -->
  </div>
</f:view>
</body>
</html>


{'fraction_non_alphanumeric': 0.16578705437706426, 'fraction_numerical': 0.005005277673737614, 'mean_word_length': 2.7916343919442292, 'pattern_counts': {'":': 0, '<': 387, '<?xml version=': 0, '>': 389, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4227187', 'n_tokens_mistral': 9696, 'n_tokens_neox': 9015, 'n_words': 1534}