001    /**
002     * Copyright (c) 2000-2013 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.portlet.asset.model;
016    
017    import com.liferay.portal.kernel.util.Validator;
018    
019    /**
020     * @author Roberto D??az
021     */
022    public class AssetQueryRule {
023    
024            public AssetQueryRule(
025                    boolean contains, boolean andOperator, String name, String[] values) {
026    
027                    _contains = contains;
028                    _andOperator = andOperator;
029                    _name = name;
030                    _values = values;
031            }
032    
033            @Override
034            public boolean equals(Object obj) {
035                    if (this == obj) {
036                            return true;
037                    }
038    
039                    if (!(obj instanceof AssetQueryRule)) {
040                            return false;
041                    }
042    
043                    AssetQueryRule assetQueryRule = (AssetQueryRule)obj;
044    
045                    if (Validator.equals(_contains, assetQueryRule._contains) &&
046                            Validator.equals(_andOperator, assetQueryRule._andOperator) &&
047                            Validator.equals(_name, assetQueryRule._name)) {
048    
049                            return true;
050                    }
051    
052                    return false;
053            }
054    
055            public String getName() {
056                    return _name;
057            }
058    
059            public String[] getValues() {
060                    return _values;
061            }
062    
063            public boolean isAndOperator() {
064                    return _andOperator;
065            }
066    
067            public boolean isContains() {
068                    return _contains;
069            }
070    
071            public void setAndOperator(boolean andOperator) {
072                    _andOperator = andOperator;
073            }
074    
075            public void setContains(boolean contains) {
076                    _contains = contains;
077            }
078    
079            public void setName(String name) {
080                    _name = name;
081            }
082    
083            public void setValues(String[] values) {
084                    _values = values;
085            }
086    
087            private boolean _andOperator;
088            private boolean _contains;
089            private String _name;
090            private String[] _values;
091    
092    }