1   /**
2    * Copyright (c) 2000-2009 Liferay, Inc. All rights reserved.
3    *
4    * Permission is hereby granted, free of charge, to any person obtaining a copy
5    * of this software and associated documentation files (the "Software"), to deal
6    * in the Software without restriction, including without limitation the rights
7    * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8    * copies of the Software, and to permit persons to whom the Software is
9    * furnished to do so, subject to the following conditions:
10   *
11   * The above copyright notice and this permission notice shall be included in
12   * all copies or substantial portions of the Software.
13   *
14   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20   * SOFTWARE.
21   */
22  
23  package com.liferay.portlet.messageboards.model.impl;
24  
25  import com.liferay.portlet.messageboards.model.MBCategory;
26  import com.liferay.portlet.messageboards.model.MBMessage;
27  import com.liferay.portlet.messageboards.model.MBMessageDisplay;
28  import com.liferay.portlet.messageboards.model.MBThread;
29  import com.liferay.portlet.messageboards.model.MBTreeWalker;
30  
31  /**
32   * <a href="MBMessageDisplayImpl.java.html"><b><i>View Source</i></b></a>
33   *
34   * @author Brian Wing Shun Chan
35   * @author Shuyang Zhou
36   *
37   */
38  public class MBMessageDisplayImpl implements MBMessageDisplay {
39  
40      public MBMessageDisplayImpl(
41          MBMessage message, MBMessage parentMessage, MBCategory category,
42          MBThread thread, MBThread previousThread, MBThread nextThread,
43          String threadView) {
44  
45          _message = message;
46          _parentMessage = parentMessage;
47          _category = category;
48          _thread = thread;
49  
50          if (!threadView.equals(MBThreadImpl.THREAD_VIEW_FLAT)) {
51              _treeWalker = new MBTreeWalkerImpl(message);
52          }
53  
54          _previousThread = previousThread;
55          _nextThread = nextThread;
56          _threadView = threadView;
57      }
58  
59      public MBMessage getMessage() {
60          return _message;
61      }
62  
63      public MBMessage getParentMessage() {
64          return _parentMessage;
65      }
66  
67      public MBCategory getCategory() {
68          return _category;
69      }
70  
71      public MBThread getThread() {
72          return _thread;
73      }
74  
75      public MBTreeWalker getTreeWalker() {
76          return _treeWalker;
77      }
78  
79      public MBThread getPreviousThread() {
80          return _previousThread;
81      }
82  
83      public MBThread getNextThread() {
84          return _nextThread;
85      }
86  
87      public String getThreadView() {
88          return _threadView;
89      }
90  
91      private MBMessage _message;
92      private MBMessage _parentMessage;
93      private MBCategory _category;
94      private MBThread _thread;
95      private MBTreeWalker _treeWalker;
96      private MBThread _previousThread;
97      private MBThread _nextThread;
98      private String _threadView;
99  
100 }