001: /*
002: * Copyright (c) JForum Team
003: * All rights reserved.
004: *
005: * Redistribution and use in source and binary forms,
006: * with or without modification, are permitted provided
007: * that the following conditions are met:
008: *
009: * 1) Redistributions of source code must retain the above
010: * copyright notice, this list of conditions and the
011: * following disclaimer.
012: * 2) Redistributions in binary form must reproduce the
013: * above copyright notice, this list of conditions and
014: * the following disclaimer in the documentation and/or
015: * other materials provided with the distribution.
016: * 3) Neither the name of "Rafael Steil" nor
017: * the names of its contributors may be used to endorse
018: * or promote products derived from this software without
019: * specific prior written permission.
020: *
021: * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
022: * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
023: * EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
024: * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
025: * MERCHANTABILITY AND FITNESS FOR A PARTICULAR
026: * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
027: * THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
028: * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
029: * EXEMPLARY, OR CONSEQUENTIAL DAMAGES
030: * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
031: * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
032: * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
033: * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
034: * IN CONTRACT, STRICT LIABILITY, OR TORT
035: * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
036: * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
037: * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE
038: *
039: * Created on 05/08/2007 12:14:52
040: *
041: * The JForum Project
042: * http://www.jforum.net
043: */
044: package net.jforum.search;
045:
046: import java.util.Date;
047:
048: /**
049: * @author Rafael Steil
050: * @version $Id: LuceneReindexArgs.java,v 1.1 2007/08/05 16:29:21 rafaelsteil Exp $
051: */
052: public class LuceneReindexArgs {
053: public static final int TYPE_UNKNOWN = 0;
054: public static final int TYPE_DATE = 1;
055: public static final int TYPE_MESSAGE = 2;
056:
057: private Date fromDate;
058: private Date toDate;
059: private int firstPostId;
060: private int lastPostId;
061: private int type;
062: private boolean avoidDuplicated;
063:
064: public LuceneReindexArgs(Date fromDate, Date toDate,
065: int firstPostId, int lastPostId, boolean avoidDuplicated,
066: int type) {
067: this .fromDate = fromDate;
068: this .toDate = toDate;
069: this .firstPostId = firstPostId;
070: this .lastPostId = lastPostId;
071: this .avoidDuplicated = avoidDuplicated;
072: this .type = type;
073: }
074:
075: /**
076: * @return the from
077: */
078: public Date getFromDate() {
079: return this .fromDate;
080: }
081:
082: /**
083: * @return the to
084: */
085: public Date getToDate() {
086: return this .toDate;
087: }
088:
089: /**
090: * @return the fetchStart
091: */
092: public int getFirstPostId() {
093: return this .firstPostId;
094: }
095:
096: /**
097: * @return the avoidDuplicated
098: */
099: public boolean avoidDuplicatedRecords() {
100: return this .avoidDuplicated;
101: }
102:
103: /**
104: * @return the fetchEnd
105: */
106: public int getLastPostId() {
107: return this .lastPostId;
108: }
109:
110: public boolean filterByDate() {
111: return this .type == TYPE_DATE && this .getFromDate() != null
112: && this .getToDate() != null;
113: }
114:
115: public boolean filterByMessage() {
116: return this.type == TYPE_MESSAGE
117: && this.getLastPostId() > this.getFirstPostId();
118: }
119: }
|