<commit_before>package org.intermine.web;

/*
 * Copyright (C) 2002-2004 FlyMine
 *
 * This code may be freely distributed and modified under the
 * terms of the GNU Lesser General Public Licence.  This should
 * be distributed with the code.  See the LICENSE file for more
 * information or http://www.gnu.org/copyleft/lesser.html.
 *
 */

import java.util.Map;
import java.util.Properties;

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

import org.apache.log4j.Logger;

import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.tiles.actions.TilesAction;

import org.intermine.objectstore.query.ConstraintOp;

/**
 * Controller Action for begin.jsp. Loads class categories and provides a category to template
 * queries map to the JSP page.
 *
 * @author <NAME>
 */

public class BeginController extends TilesAction
{
    protected static final Logger LOG = Logger.getLogger(BeginController.class);
    
    /**
     * Populate request with browse box parameters etc.
     *
     * @param mapping The ActionMapping used to select this instance
     * @param form The optional ActionForm bean for this request (if any)
     * @param request The HTTP request we are processing
     * @param response The HTTP response we are creating
     * @return an ActionForward object defining where control goes next
     *
     * @exception Exception if an error occurs
     */
    public ActionForward execute(ActionMapping mapping,
                                 ActionForm form,
                                 HttpServletRequest request,
                                 HttpServletResponse response) throws Exception {
        HttpSession session = request.getSession();
        ServletContext servletContext = session.getServletContext();
        Properties properties = (Properties) servletContext.getAttribute(Constants.WEB_PROPERTIES);
        Map templateQueries = (Map) servletContext.getAttribute(Constants.TEMPLATE_QUERIES);
        
        if (properties != null) {
            session.setAttribute("queryName", properties.getProperty("begin.browse.template"));
            // might want to make the operator a model web.properties property
            request.setAttribute("browseOperator", ConstraintOp.MATCHES.getIndex());
        }
        
        return null;
    }
}<commit_msg>Setting session attribute templateTYpe to 'global' - really need a better way<commit_after>package org.intermine.web;

/*
 * Copyright (C) 2002-2004 FlyMine
 *
 * This code may be freely distributed and modified under the
 * terms of the GNU Lesser General Public Licence.  This should
 * be distributed with the code.  See the LICENSE file for more
 * information or http://www.gnu.org/copyleft/lesser.html.
 *
 */

import java.util.Properties;

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

import org.apache.log4j.Logger;

import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.tiles.actions.TilesAction;

import org.intermine.objectstore.query.ConstraintOp;

/**
 * Controller Action for begin.jsp. Loads class categories and provides a category to template
 * queries map to the JSP page.
 *
 * @author <NAME>
 */

public class BeginController extends TilesAction
{
    protected static final Logger LOG = Logger.getLogger(BeginController.class);
    
    /**
     * Populate request with browse box parameters etc.
     *
     * @param mapping The ActionMapping used to select this instance
     * @param form The optional ActionForm bean for this request (if any)
     * @param request The HTTP request we are processing
     * @param response The HTTP response we are creating
     * @return an ActionForward object defining where control goes next
     *
     * @exception Exception if an error occurs
     */
    public ActionForward execute(ActionMapping mapping,
                                 ActionForm form,
                                 HttpServletRequest request,
                                 HttpServletResponse response) throws Exception {
        HttpSession session = request.getSession();
        ServletContext servletContext = session.getServletContext();
        Properties properties = (Properties) servletContext.getAttribute(Constants.WEB_PROPERTIES);
        
        if (properties != null) {
            session.setAttribute("queryName", properties.getProperty("begin.browse.template"));
            session.setAttribute("templateType", "global");
            // might want to make the operator a model web.properties property
            request.setAttribute("browseOperator", ConstraintOp.MATCHES.getIndex());
        }
        
        return null;
    }
}
{'fraction_non_alphanumeric': 0.07777557886404117, 'fraction_numerical': 0.0035622402533148625, 'mean_word_length': 3.0464371497197757, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5448505', 'n_tokens_mistral': 1262, 'n_tokens_neox': 1246, 'n_words': 404}