⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 defaultqueryaction.java

📁 A Java web application, based on Struts and Hibernate, that serves as an online running log. Users m
💻 JAVA
字号:
/* @LICENSE_COPYRIGHT@ */
package net.sf.irunninglog.servlet.action;

import java.util.Collection;

import javax.servlet.http.HttpServletRequest;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;

import net.sf.irunninglog.servlet.UserContainer;
import net.sf.irunninglog.servlet.formbean.QueryResultsFormBean;

/**
 * Class responsible for performing a 'default' query.  This class provides a
 * simple implementation of the <code>executeAfterQuery</code> method which
 * takes care of converting query result objects into <code>ValueBean</code>
 * instances and stores them in a <code>QueryResultsFormBean</code>.
 *
 * @author <a href="mailto:allan_e_lewis@yahoo.com">Allan Lewis</a>
 * @version $Revision: 1.1.1.1 $ $Date: 2005/06/23 01:49:00 $
 * @since iRunningLog 1.0
 */
public abstract class DefaultQueryAction extends BaseQueryAction {

    /** Log instance for this class. */
    private static final Log LOG = LogFactory.getLog(DefaultQueryAction.class);

    /**
     * Convert any query result <code>DTO</code>s into <code>ValueBean</code>s
     * and store them in a <code>QueryResultsFormBean</code>.
     *
     * @param mapping The <code>ActionMapping</code> used to select this
     *                instance.
     * @param form The <code>QueryResultsFormBean</code> that will contain the
     *             query results
     * @param request The HTTP request being processed
     * @param container The <code>UserContainer</code> object for the current
     *                  user
     * @param results The collection of <code>DTO</code>s returned from the
     *                <code>executeQuery</code> method
     */
    protected void executeAfterQuery(ActionMapping mapping,
                                     ActionForm form,
                                     HttpServletRequest request,
                                     UserContainer container,
                                     Collection results) {

        super.executeAfterQuery(mapping, form, request, container, results);
        QueryResultsFormBean queryResults = (QueryResultsFormBean) form;

        if (LOG.isDebugEnabled()) {
            LOG.debug("executeAfterQuery: Found this many results "
                      + results.size());
            LOG.debug("executeAfterQuery: Query found the following results "
                      + results);
            LOG.debug("executeAfterQuery: Form bean before adding results "
                      + queryResults);
        }

        queryResults.setResults(createValueBeans(mapping, results));

        if (LOG.isDebugEnabled()) {
            LOG.debug("executeAfterQuery: Form bean after adding results "
                      + queryResults);
        }
    }

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -