001    /**
002     * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
013     */
014    
015    package com.liferay.portlet.shopping.search;
016    
017    import com.liferay.portal.kernel.dao.search.DAOParamUtil;
018    import com.liferay.portlet.shopping.model.ShoppingOrderConstants;
019    
020    import javax.portlet.PortletRequest;
021    
022    /**
023     * @author Brian Wing Shun Chan
024     */
025    public class OrderSearchTerms extends OrderDisplayTerms {
026    
027            public OrderSearchTerms(PortletRequest portletRequest) {
028                    super(portletRequest);
029    
030                    emailAddress = DAOParamUtil.getLike(portletRequest, EMAIL_ADDRESS);
031                    firstName = DAOParamUtil.getLike(portletRequest, FIRST_NAME);
032                    lastName = DAOParamUtil.getLike(portletRequest, LAST_NAME);
033                    number = DAOParamUtil.getLike(portletRequest, NUMBER);
034                    status = DAOParamUtil.getString(portletRequest, STATUS);
035            }
036    
037            public String getStatus() {
038                    if (status == null) {
039                            return null;
040                    }
041                    else if (status.equals(ShoppingOrderConstants.STATUSES[0])) {
042                            return ShoppingOrderConstants.STATUS_CHECKOUT;
043                    }
044                    else if (status.equals(ShoppingOrderConstants.STATUSES[1])) {
045                            return ShoppingOrderConstants.STATUS_COMPLETED;
046                    }
047                    else if (status.equals(ShoppingOrderConstants.STATUSES[2])) {
048                            return ShoppingOrderConstants.STATUS_DENIED;
049                    }
050                    else if (status.equals(ShoppingOrderConstants.STATUSES[3])) {
051                            return ShoppingOrderConstants.STATUS_PENDING;
052                    }
053                    else if (status.equals(ShoppingOrderConstants.STATUSES[4])) {
054                            return ShoppingOrderConstants.STATUS_REFUNDED;
055                    }
056                    else {
057                            return null;
058                    }
059            }
060    
061    }