001    /**
002     * Copyright (c) 2000-2011 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.messageboards.model.impl;
016    
017    import com.liferay.portlet.messageboards.model.MBCategory;
018    import com.liferay.portlet.messageboards.model.MBMessage;
019    import com.liferay.portlet.messageboards.model.MBMessageDisplay;
020    import com.liferay.portlet.messageboards.model.MBThread;
021    import com.liferay.portlet.messageboards.model.MBThreadConstants;
022    import com.liferay.portlet.messageboards.model.MBTreeWalker;
023    
024    /**
025     * @author Brian Wing Shun Chan
026     * @author Shuyang Zhou
027     */
028    public class MBMessageDisplayImpl implements MBMessageDisplay {
029    
030            public MBMessageDisplayImpl(
031                    MBMessage message, MBMessage parentMessage, MBCategory category,
032                    MBThread thread, MBThread previousThread, MBThread nextThread,
033                    int status, String threadView) {
034    
035                    _message = message;
036                    _parentMessage = parentMessage;
037                    _category = category;
038                    _thread = thread;
039    
040                    if (!threadView.equals(MBThreadConstants.THREAD_VIEW_FLAT)) {
041                            _treeWalker = new MBTreeWalkerImpl(message, status);
042                    }
043    
044                    _previousThread = previousThread;
045                    _nextThread = nextThread;
046                    _threadView = threadView;
047            }
048    
049            public MBCategory getCategory() {
050                    return _category;
051            }
052    
053            public MBMessage getMessage() {
054                    return _message;
055            }
056    
057            public MBThread getNextThread() {
058                    return _nextThread;
059            }
060    
061            public MBMessage getParentMessage() {
062                    return _parentMessage;
063            }
064    
065            public MBThread getPreviousThread() {
066                    return _previousThread;
067            }
068    
069            public MBThread getThread() {
070                    return _thread;
071            }
072    
073            public String getThreadView() {
074                    return _threadView;
075            }
076    
077            public MBTreeWalker getTreeWalker() {
078                    return _treeWalker;
079            }
080    
081            private MBCategory _category;
082            private MBMessage _message;
083            private MBThread _nextThread;
084            private MBMessage _parentMessage;
085            private MBThread _previousThread;
086            private MBThread _thread;
087            private String _threadView;
088            private MBTreeWalker _treeWalker;
089    
090    }