001    /**
002     * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
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    }