<commit_before>package edu.columbia.gemma.web.controller.entrez.pubmed;

import java.util.HashMap;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.configuration.Configuration;
import org.apache.commons.configuration.ConfigurationException;
import org.apache.commons.configuration.PropertiesConfiguration;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.validation.BindException;
import org.springframework.web.bind.RequestUtils;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.View;
import org.springframework.web.servlet.mvc.SimpleFormController;
import org.springframework.web.servlet.view.InternalResourceView;

import edu.columbia.gemma.common.description.BibliographicReference;
import edu.columbia.gemma.common.description.BibliographicReferenceService;
import edu.columbia.gemma.loader.entrez.pubmed.PubMedXMLFetcher;

/**
 * Allows user to view the results of a pubMed search, with the option of submitting the results.
 * <hr>
 * <p>
 * Copyright (c) 2004 - 2005 Columbia University
 * 
 * @author keshav
 * @version $Id$
 * @spring.bean id="pubMedXmlController"
 * @spring.property name="sessionForm" value="true"
 * @spring.property name="formView" value="pubMedForm"
 * @spring.property name="successView" value="pubMedSuccess"
 * @spring.property name = "pubMedXmlFetcher" ref="pubMedXmlFetcher"
 * @spring.property name = "bibliographicReferenceService" ref="bibliographicReferenceService"
 */
public class PubMedXmlController extends SimpleFormController {
    private String alreadyExists;
    private boolean alreadyViewed = false;
    private BibliographicReferenceService bibliographicReferenceService;
    private String bibRef;
    private Configuration conf;
    private String pubMedId = null;
    private PubMedXMLFetcher pubMedXmlFetcher;
    private String requestPubMedId;
    private String sessionViewOne = null;

    /** Logger for this class and subclasses */
    protected final Log log = LogFactory.getLog( getClass() );

    /**
     * @throws ConfigurationException
     */
    public PubMedXmlController() throws ConfigurationException {
        conf = new PropertiesConfiguration( "entrez.properties" );
        alreadyExists = conf.getString( "entrez.pubmed.alreadyExists" );
        bibRef = conf.getString( "entrez.pubmed.bibRef" );
        requestPubMedId = conf.getString( "entrez.pubmed.pubMedId" );
        sessionViewOne = conf.getString( "entrez.pubmed.sessionViewOne" );
    }

    /**
     * @return Returns the bibliographicReferenceService.
     */
    public BibliographicReferenceService getBibliographicReferenceService() {
        return bibliographicReferenceService;
    }

    /**
     * @return Returns the pubMedXmlFetcher.
     */
    public PubMedXMLFetcher getPubMedXmlFetcher() {
        return pubMedXmlFetcher;
    }

    /**
     * Useful for debugging, specifically with Tomcat security issues.
     * 
     * @param request<commit_msg>updated properties file<commit_after>package edu.columbia.gemma.web.controller.entrez.pubmed;

import java.util.HashMap;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.configuration.Configuration;
import org.apache.commons.configuration.ConfigurationException;
import org.apache.commons.configuration.PropertiesConfiguration;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.validation.BindException;
import org.springframework.web.bind.RequestUtils;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.View;
import org.springframework.web.servlet.mvc.SimpleFormController;
import org.springframework.web.servlet.view.InternalResourceView;

import edu.columbia.gemma.common.description.BibliographicReference;
import edu.columbia.gemma.common.description.BibliographicReferenceService;
import edu.columbia.gemma.loader.entrez.pubmed.PubMedXMLFetcher;

/**
 * Allows user to view the results of a pubMed search, with the option of submitting the results.
 * <hr>
 * <p>
 * Copyright (c) 2004 - 2005 Columbia University
 * 
 * @author keshav
 * @version $Id$
 * @spring.bean id="pubMedXmlController"
 * @spring.property name="sessionForm" value="true"
 * @spring.property name="formView" value="pubMedForm"
 * @spring.property name="successView" value="pubMedSuccess"
 * @spring.property name = "pubMedXmlFetcher" ref="pubMedXmlFetcher"
 * @spring.property name = "bibliographicReferenceService" ref="bibliographicReferenceService"
 */
public class PubMedXmlController extends SimpleFormController {
    private String alreadyExists;
    private boolean alreadyViewed = false;
    private BibliographicReferenceService bibliographicReferenceService;
    private String bibRef;
    private Configuration conf;
    private String pubMedId = null;
    private PubMedXMLFetcher pubMedXmlFetcher;
    private String requestPubMedId;
    private String sessionViewOne = null;

    /** Logger for this class and subclasses */
    protected final Log log = LogFactory.getLog( getClass() );

    /**
     * @throws ConfigurationException
     */
    public PubMedXmlController() throws ConfigurationException {
        conf = new PropertiesConfiguration( "Gemma.properties" );
        alreadyExists = conf.getString( "entrez.pubmed.alreadyExists" );
        bibRef = conf.getString( "entrez.pubmed.bibRef" );
        requestPubMedId = conf.getString( "entrez.pubmed.pubMedId" );
        sessionViewOne = conf.getString( "entrez.pubmed.sessionViewOne" );
    }

    /**
     * @return Returns the bibliographicReferenceService.
     */
    public BibliographicReferenceService getBibliographicReferenceService() {
        return bibliographicReferenceService;
    }

    /**
     * @return Returns the pubMedXmlFetcher.
     */
    public PubMedXMLFetcher getPubMedXmlFetcher() {
        return pubMedXmlFetcher;
    }

    /**
     * Useful for debugging, specifically with Tomcat security issues.
     * 
     * @param request
{'fraction_non_alphanumeric': 0.09291110753898087, 'fraction_numerical': 0.002571933772705353, 'mean_word_length': 4.530666666666667, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, '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': '5566653', 'n_tokens_mistral': 1706, 'n_tokens_neox': 1683, 'n_words': 367}