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    
019    /**
020     * @author Michael C. Han
021     */
022    public class MissingFilter extends BaseFilter {
023    
024            public MissingFilter(String field) {
025                    _field = field;
026            }
027    
028            @Override
029            public <T> T accept(FilterVisitor<T> filterVisitor) {
030                    return filterVisitor.visit(this);
031            }
032    
033            public String getField() {
034                    return _field;
035            }
036    
037            @Override
038            public int getSortOrder() {
039                    return 2;
040            }
041    
042            public Boolean isExists() {
043                    return _exists;
044            }
045    
046            public Boolean isNullValue() {
047                    return _nullValue;
048            }
049    
050            public void setExists(boolean exists) {
051                    _exists = exists;
052            }
053    
054            public void setNullValue(boolean nullValue) {
055                    _nullValue = nullValue;
056            }
057    
058            @Override
059            public String toString() {
060                    StringBundler sb = new StringBundler(9);
061    
062                    sb.append("{(");
063                    sb.append(_field);
064                    sb.append(", _exists=");
065                    sb.append(_exists);
066                    sb.append(", _nullValue=");
067                    sb.append(_nullValue);
068                    sb.append("), ");
069                    sb.append(super.toString());
070                    sb.append("}");
071    
072                    return sb.toString();
073            }
074    
075            private Boolean _exists;
076            private final String _field;
077            private Boolean _nullValue;
078    
079    }