SearchBean

/**
 * © 2001 - 2005 eBworx Bhd. All rights reserved.
 * 7th & 8th Floor, Menara Merais,
 * No. 1, Jalan 19/3,
 * 46300 Petaling Jaya,
 * Selangor Darul Ehsan,
 * Malaysia.
 *
 * This software is the intellectual property of eBworx Bhd. The program
 * may be used only in accordance with the terms of the license agreement you
 * entered into with eBworx.
 */
package com.ebworx.core.base.metadata;

import java.io.Serializable;
import java.util.List;

/*
-------------------------------------------------------------------------
Developer      Date            Comments
---------      -----------     ------------------------------------------
ktlim          Aug 24, 2005    Initial version.
-------------------------------------------------------------------------
*/
 
/**
 * Bean for wrapping searching criteria as well as searching result
 *
 * @author ktlim
 * @version $Id: SearchBean.java,v 1.1 2006/10/30 02:33:30 xiongyan Exp $
 */
public class SearchBean implements Serializable, Cloneable
{

    private static final long serialVersionUID = 1L;

    public static final String SEARCH_BY_CODE = "code";
    public static final String SEARCH_BY_DESCRIPTION = "description";

    private String criteria;
    private String value;
    private int currentPage;
    private int totalPage;
    // Added to make search bean contains all search required object.
    // default is med_row_per_page, but still can be overrided by caller.
    private int totalRowPerPage = ICoreConstants.MED_ROW_PER_PAGE;
    private List resultList;
    private String resultLinkKey;
    private boolean searchExecuted;

    public SearchBean()
    {
        init();
    }

    public void init()
    {
        criteria = null;
        value = null;
        currentPage = 1;
        totalPage = 1;
        resultList = null;
        resultLinkKey = null;
        searchExecuted = false;
    }

    public String getCriteria()
    {
        if (criteria != null) criteria = criteria.trim();
        return criteria;
    }

    public void setCriteria(String criteria)
    {
        this.criteria = criteria;
    }

    public String getValue()
    {
        if (value != null) value = value.trim();
        return value;
    }

    public void setValue(String value)
    {
        this.value = value;
    }

    public int getCurrentPage()
    {
        return currentPage;
    }

    public void setCurrentPage(int currentPage)
    {
        this.currentPage = currentPage;
    }

    public int getTotalPage()
    {
        return totalPage;
    }

    public void setTotalPage(int totalPage)
    {
        this.totalPage = totalPage;
    }

    public List getResultList()
    {
        return resultList;
    }

    public void setResultList(List resultList)
    {
        this.resultList = resultList;
    }

    public String getResultLinkKey()
    {
        // if (resultLinkKey != null) resultLinkKey = resultLinkKey.trim();
        return resultLinkKey;
    }

    public void setResultLinkKey(String resultLinkKey)
    {
        this.resultLinkKey = resultLinkKey;
    }

    public boolean isSearchExecuted()
    {
        return searchExecuted;
    }

    public void setSearchExecuted(boolean searchExecuted)
    {
        this.searchExecuted = searchExecuted;
    }

    /**
     * Pre-validate paging parameter before searching.
     */
    public void beforeSearch()
    {
        if (currentPage < 1)
        {
            currentPage = 1;
        }
    }

    /**
     * Post-validate paging parameter after searching.
     */
    public void afterSearch()
    {
        // checking to avoid invalid page number shown on screen; if current page requested is
        // greater than total pages available, set current page count to total page available
        if (currentPage > totalPage)
        {
            currentPage = totalPage;
        }
        searchExecuted = true;
    }

    public Object clone() throws CloneNotSupportedException
    {
        return super.clone();
    }

    public int getTotalRowPerPage()
    {
        return totalRowPerPage;
    }

    public void setTotalRowPerPage(int totalRowPerPage)
    {
        this.totalRowPerPage = totalRowPerPage;
    }

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值