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