<commit_before>/**
 * <p>Title: CommonSearchAction Class>
 * <p>Description:	This class is used to retrieve the information whose record
 * is to be modified.</p>
 * Copyright:    Copyright (c) year
 * Company: Washington University, School of Medicine, St. Louis.
 * @author <NAME>
 * @version 1.00
 * Created on Apr 20, 2005
 */

package edu.wustl.catissuecore.action;

import java.io.IOException;
import java.rmi.ServerException;
import java.util.List;

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

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionError;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import edu.wustl.catissuecore.actionForm.AbstractActionForm;
import edu.wustl.catissuecore.bizlogic.AbstractBizLogic;
import edu.wustl.catissuecore.bizlogic.BizLogicFactory;
import edu.wustl.catissuecore.domain.AbstractDomainObject;
import edu.wustl.catissuecore.util.global.ApplicationProperties;
import edu.wustl.catissuecore.util.global.Constants;
import edu.wustl.common.util.dbManager.DAOException;
import edu.wustl.common.util.logger.Logger;


/**
 * This class is used to retrieve the information whose record is to be modified.
 * @author gautam_shetty
 */
public class CommonSearchAction extends Action
{
    /**
     * Overrides the execute method of Action class.
     * Retrieves and populates the information to be edited. 
     * */
    public ActionForward execute(ActionMapping mapping, ActionForm form,
            HttpServletRequest request, HttpServletResponse response)
            throws IOException, ServerException
    {
        /** 
         * Represents whether the search operation was successful or not.
         */
        String target = null;
        
        AbstractActionForm abstractForm = (AbstractActionForm) form;

        /* Get the systemIdentifier whose information is to be searched */
        long identifier = ((Long)request.getAttribute(Constants.IDENTIFIER)).longValue();

        try
        {
            AbstractBizLogic bizLogic = BizLogicFactory.getBizLogic(abstractForm.getFormId());
            AbstractDomainObject abstractDomain = null;
            List list = null;
            
            //Retrieves the information to be edited.
            String objName = AbstractDomainObject.getDomainObjectName(abstractForm.getFormId());
            list= bizLogic.retrieve(objName,Constants.IDENTIFIER, new Long(identifier).toString());

            if (list.size() != 0)
            {
                /* If the record searched is present in the database,
                 * populate the formbean with the information retrieved.  
                 */
                abstractDomain = (AbstractDomainObject)list.get(0);
                abstractForm.setAllValues(abstractDomain);
                request.setAttribute(mapping.getAttribute(),form);
                String pageOf = request.getParameter(Constants.PAGEOF);
                target = new String(pageOf);
            }
            else
            {
                /* If the searched record is not present in the database,  
                 * display an Error message.
                 */
                ActionErrors errors = new ActionErrors();
                errors.add(ActionErrors.GLOBAL_ERROR, new ActionError("errors.item.unknown",
                        				ApplicationProperties.getValue("user.name")));
                saveErrors(request,errors);
                target = new String(Constants.FAILURE);
            }
        }
        catch (DAOException excp)
        {
            target = new String(Constants.FAILURE);
            Logger.out.error(excp.getMessage());
        }
        return (mapping.findForward(target));
    }
}<commit_msg>get pageOf as request attribute<commit_after>/**
 * <p>Title: CommonSearchAction Class>
 * <p>Description:	This class is used to retrieve the information whose record
 * is to be modified.</p>
 * Copyright:    Copyright (c) year
 * Company: Washington University, School of Medicine, St. Louis.
 * @author <NAME>
 * @version 1.00
 * Created on Apr 20, 2005
 */

package edu.wustl.catissuecore.action;

import java.io.IOException;
import java.rmi.ServerException;
import java.util.List;

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

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionError;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import edu.wustl.catissuecore.actionForm.AbstractActionForm;
import edu.wustl.catissuecore.bizlogic.AbstractBizLogic;
import edu.wustl.catissuecore.bizlogic.BizLogicFactory;
import edu.wustl.catissuecore.domain.AbstractDomainObject;
import edu.wustl.catissuecore.util.global.ApplicationProperties;
import edu.wustl.catissuecore.util.global.Constants;
import edu.wustl.common.util.dbManager.DAOException;
import edu.wustl.common.util.logger.Logger;


/**
 * This class is used to retrieve the information whose record is to be modified.
 * @author gautam_shetty
 */
public class CommonSearchAction extends Action
{
    /**
     * Overrides the execute method of Action class.
     * Retrieves and populates the information to be edited. 
     * */
    public ActionForward execute(ActionMapping mapping, ActionForm form,
            HttpServletRequest request, HttpServletResponse response)
            throws IOException, ServerException
    {
        /** 
         * Represents whether the search operation was successful or not.
         */
        String target = null;
        
        AbstractActionForm abstractForm = (AbstractActionForm) form;

        /* Get the systemIdentifier whose information is to be searched */
        long identifier = ((Long)request.getAttribute(Constants.IDENTIFIER)).longValue();

        try
        {
            AbstractBizLogic bizLogic = BizLogicFactory.getBizLogic(abstractForm.getFormId());
            AbstractDomainObject abstractDomain = null;
            List list = null;
            
            //Retrieves the information to be edited.
            String objName = AbstractDomainObject.getDomainObjectName(abstractForm.getFormId());
            list= bizLogic.retrieve(objName,Constants.IDENTIFIER, new Long(identifier).toString());

            if (list.size() != 0)
            {
                /* If the record searched is present in the database,
                 * populate the formbean with the information retrieved.  
                 */
                abstractDomain = (AbstractDomainObject)list.get(0);
                abstractForm.setAllValues(abstractDomain);
                request.setAttribute(mapping.getAttribute(),form);
                String pageOf = (String)request.getAttribute(Constants.PAGEOF);
                target = pageOf;
            }
            else
            {
                /* If the searched record is not present in the database,  
                 * display an Error message.
                 */
                ActionErrors errors = new ActionErrors();
                errors.add(ActionErrors.GLOBAL_ERROR, new ActionError("errors.item.unknown",
                        				ApplicationProperties.getValue("user.name")));
                saveErrors(request,errors);
                target = new String(Constants.FAILURE);
            }
        }
        catch (DAOException excp)
        {
            target = Constants.FAILURE;
            Logger.out.error(excp.getMessage());
        }
        return (mapping.findForward(target));
    }
}
{'fraction_non_alphanumeric': 0.08770576131687242, 'fraction_numerical': 0.002829218106995885, 'mean_word_length': 2.5527638190954773, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 13, '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': '828461', 'n_tokens_mistral': 2051, 'n_tokens_neox': 2004, 'n_words': 492}