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.portal.kernel.search;
016    
017    import com.liferay.portal.kernel.repository.model.FileEntry;
018    import com.liferay.portal.kernel.util.Tuple;
019    import com.liferay.portal.kernel.util.Validator;
020    import com.liferay.portlet.messageboards.model.MBMessage;
021    
022    import java.util.ArrayList;
023    import java.util.List;
024    
025    /**
026     * @author Eudaldo Alonso
027     */
028    public class SearchResult {
029    
030            public SearchResult(String className, long classPK) {
031                    _className = className;
032                    _classPK = classPK;
033            }
034    
035            public void addFileEntry(FileEntry fileEntry, Summary summary) {
036                    Tuple tuple = new Tuple(fileEntry, summary);
037    
038                    _fileEntryTuples.add(tuple);
039            }
040    
041            public void addMBMessage(MBMessage mbMessage) {
042                    _mbMessages.add(mbMessage);
043            }
044    
045            public void addVersion(String version) {
046                    _versions.add(version);
047            }
048    
049            @Override
050            public boolean equals(Object obj) {
051                    if (this == obj) {
052                            return true;
053                    }
054    
055                    if (!(obj instanceof SearchResult)) {
056                            return false;
057                    }
058    
059                    SearchResult searchResult = (SearchResult)obj;
060    
061                    if (Validator.equals(_classPK, searchResult._classPK) &&
062                            Validator.equals(_className, searchResult._className)) {
063    
064                            return true;
065                    }
066    
067                    return false;
068            }
069    
070            public String getClassName() {
071                    return _className;
072            }
073    
074            public long getClassPK() {
075                    return _classPK;
076            }
077    
078            public List<Tuple> getFileEntryTuples() {
079                    return _fileEntryTuples;
080            }
081    
082            public List<MBMessage> getMBMessages() {
083                    return _mbMessages;
084            }
085    
086            public Summary getSummary() {
087                    return _summary;
088            }
089    
090            public List<String> getVersions() {
091                    return _versions;
092            }
093    
094            public void setClassName(String className) {
095                    _className = className;
096            }
097    
098            public void setClassPK(long classPK) {
099                    _classPK = classPK;
100            }
101    
102            public void setMessages(List<MBMessage> mbMessages) {
103                    _mbMessages = mbMessages;
104            }
105    
106            public void setSummary(Summary summary) {
107                    _summary = summary;
108            }
109    
110            private String _className;
111            private long _classPK;
112            private List<Tuple> _fileEntryTuples = new ArrayList<Tuple>();
113            private List<MBMessage> _mbMessages = new ArrayList<MBMessage>();
114            private Summary _summary;
115            private List<String> _versions = new ArrayList<String>();
116    
117    }