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.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            @Override
053            public MBCategory getCategory() {
054                    return _category;
055            }
056    
057            @Override
058            public MBMessage getMessage() {
059                    return _message;
060            }
061    
062            @Override
063            public MBThread getNextThread() {
064                    return _nextThread;
065            }
066    
067            @Override
068            public MBMessage getParentMessage() {
069                    return _parentMessage;
070            }
071    
072            @Override
073            public MBThread getPreviousThread() {
074                    return _previousThread;
075            }
076    
077            @Override
078            public MBThread getThread() {
079                    return _thread;
080            }
081    
082            @Override
083            public String getThreadView() {
084                    return _threadView;
085            }
086    
087            @Override
088            public MBTreeWalker getTreeWalker() {
089                    return _treeWalker;
090            }
091    
092            private MBCategory _category;
093            private MBMessage _message;
094            private MBThread _nextThread;
095            private MBMessage _parentMessage;
096            private MBThread _previousThread;
097            private MBThread _thread;
098            private String _threadView;
099            private MBTreeWalker _treeWalker;
100    
101    }