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            @Override
046            public boolean equals(Object obj) {
047                    if (this == obj) {
048                            return true;
049                    }
050    
051                    if (!(obj instanceof SearchResult)) {
052                            return false;
053                    }
054    
055                    SearchResult searchResult = (SearchResult)obj;
056    
057                    if (Validator.equals(_classPK, searchResult._classPK) &&
058                            Validator.equals(_className, searchResult._className)) {
059    
060                            return true;
061                    }
062    
063                    return false;
064            }
065    
066            public String getClassName() {
067                    return _className;
068            }
069    
070            public long getClassPK() {
071                    return _classPK;
072            }
073    
074            public List<Tuple> getFileEntryTuples() {
075                    return _fileEntryTuples;
076            }
077    
078            public List<MBMessage> getMBMessages() {
079                    return _mbMessages;
080            }
081    
082            public Summary getSummary() {
083                    return _summary;
084            }
085    
086            public void setClassName(String className) {
087                    _className = className;
088            }
089    
090            public void setClassPK(long classPK) {
091                    _classPK = classPK;
092            }
093    
094            public void setMessages(List<MBMessage> mbMessages) {
095                    _mbMessages = mbMessages;
096            }
097    
098            public void setSummary(Summary summary) {
099                    _summary = summary;
100            }
101    
102            private String _className;
103            private long _classPK;
104            private List<Tuple> _fileEntryTuples = new ArrayList<Tuple>();
105            private List<MBMessage> _mbMessages = new ArrayList<MBMessage>();
106            private Summary _summary;
107    
108    }