001    /**
002     * Copyright (c) 2000-present Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portal.kernel.search.filter;
016    
017    import com.liferay.portal.kernel.util.StringBundler;
018    import com.liferay.portal.kernel.util.TimeZoneUtil;
019    
020    import java.util.TimeZone;
021    
022    /**
023     * @author Michael C. Han
024     */
025    public class DateRangeTermFilter extends RangeTermFilter {
026    
027            public DateRangeTermFilter(
028                    String field, boolean includesLower, boolean includesUpper,
029                    String startDate, String endDate) {
030    
031                    super(field, includesLower, includesUpper, startDate, endDate);
032            }
033    
034            public String getDateFormat() {
035                    return _dateFormat;
036            }
037    
038            @Override
039            public int getSortOrder() {
040                    return 25;
041            }
042    
043            public TimeZone getTimeZone() {
044                    return _timeZone;
045            }
046    
047            public void setDateFormat(String dateFormat) {
048                    _dateFormat = dateFormat;
049            }
050    
051            public void setTimeZone(TimeZone timeZone) {
052                    _timeZone = timeZone;
053            }
054    
055            @Override
056            public String toString() {
057                    StringBundler sb = new StringBundler(7);
058    
059                    sb.append("{(");
060                    sb.append(super.toString());
061                    sb.append("), ");
062                    sb.append(_dateFormat);
063                    sb.append(", ");
064                    sb.append(_timeZone);
065                    sb.append(")}");
066    
067                    return sb.toString();
068            }
069    
070            private String _dateFormat = "yyyyMMddHHmmss";
071            private TimeZone _timeZone = TimeZoneUtil.getDefault();
072    
073    }