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