1   /**
2    * Copyright (c) 2000-2009 Liferay, Inc. All rights reserved.
3    *
4    * The contents of this file are subject to the terms of the Liferay Enterprise
5    * Subscription License ("License"). You may not use this file except in
6    * compliance with the License. You can obtain a copy of the License by
7    * contacting Liferay, Inc. See the License for the specific language governing
8    * permissions and limitations under the License, including but not limited to
9    * distribution rights of the Software.
10   *
11   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
12   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
13   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
14   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
15   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
16   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
17   * SOFTWARE.
18   */
19  
20  package com.liferay.portlet.messageboards.model.impl;
21  
22  import com.liferay.portlet.messageboards.model.MBCategory;
23  import com.liferay.portlet.messageboards.model.MBMessage;
24  import com.liferay.portlet.messageboards.model.MBMessageDisplay;
25  import com.liferay.portlet.messageboards.model.MBThread;
26  import com.liferay.portlet.messageboards.model.MBTreeWalker;
27  
28  /**
29   * <a href="MBMessageDisplayImpl.java.html"><b><i>View Source</i></b></a>
30   *
31   * @author Brian Wing Shun Chan
32   * @author Shuyang Zhou
33   *
34   */
35  public class MBMessageDisplayImpl implements MBMessageDisplay {
36  
37      public MBMessageDisplayImpl(
38          MBMessage message, MBMessage parentMessage, MBCategory category,
39          MBThread thread, MBThread previousThread, MBThread nextThread,
40          String threadView) {
41  
42          _message = message;
43          _parentMessage = parentMessage;
44          _category = category;
45          _thread = thread;
46  
47          if (!threadView.equals(MBThreadImpl.THREAD_VIEW_FLAT)) {
48              _treeWalker = new MBTreeWalkerImpl(message);
49          }
50  
51          _previousThread = previousThread;
52          _nextThread = nextThread;
53          _threadView = threadView;
54      }
55  
56      public MBMessage getMessage() {
57          return _message;
58      }
59  
60      public MBMessage getParentMessage() {
61          return _parentMessage;
62      }
63  
64      public MBCategory getCategory() {
65          return _category;
66      }
67  
68      public MBThread getThread() {
69          return _thread;
70      }
71  
72      public MBTreeWalker getTreeWalker() {
73          return _treeWalker;
74      }
75  
76      public MBThread getPreviousThread() {
77          return _previousThread;
78      }
79  
80      public MBThread getNextThread() {
81          return _nextThread;
82      }
83  
84      public String getThreadView() {
85          return _threadView;
86      }
87  
88      private MBMessage _message;
89      private MBMessage _parentMessage;
90      private MBCategory _category;
91      private MBThread _thread;
92      private MBTreeWalker _treeWalker;
93      private MBThread _previousThread;
94      private MBThread _nextThread;
95      private String _threadView;
96  
97  }