1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * This library is free software; you can redistribute it and/or modify it under
5    * the terms of the GNU Lesser General Public License as published by the Free
6    * Software Foundation; either version 2.1 of the License, or (at your option)
7    * any later version.
8    *
9    * This library is distributed in the hope that it will be useful, but WITHOUT
10   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11   * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12   * details.
13   */
14  
15  package com.liferay.portlet.messageboards.model.impl;
16  
17  import com.liferay.portlet.messageboards.model.MBCategory;
18  import com.liferay.portlet.messageboards.model.MBMessage;
19  import com.liferay.portlet.messageboards.model.MBMessageDisplay;
20  import com.liferay.portlet.messageboards.model.MBThread;
21  import com.liferay.portlet.messageboards.model.MBThreadConstants;
22  import com.liferay.portlet.messageboards.model.MBTreeWalker;
23  
24  /**
25   * <a href="MBMessageDisplayImpl.java.html"><b><i>View Source</i></b></a>
26   *
27   * @author Brian Wing Shun Chan
28   * @author Shuyang Zhou
29   */
30  public class MBMessageDisplayImpl implements MBMessageDisplay {
31  
32      public MBMessageDisplayImpl(
33          MBMessage message, MBMessage parentMessage, MBCategory category,
34          MBThread thread, MBThread previousThread, MBThread nextThread,
35          int status, String threadView) {
36  
37          _message = message;
38          _parentMessage = parentMessage;
39          _category = category;
40          _thread = thread;
41  
42          if (!threadView.equals(MBThreadConstants.THREAD_VIEW_FLAT)) {
43              _treeWalker = new MBTreeWalkerImpl(message, status);
44          }
45  
46          _previousThread = previousThread;
47          _nextThread = nextThread;
48          _threadView = threadView;
49      }
50  
51      public MBCategory getCategory() {
52          return _category;
53      }
54  
55      public MBMessage getMessage() {
56          return _message;
57      }
58  
59      public MBThread getNextThread() {
60          return _nextThread;
61      }
62  
63      public MBMessage getParentMessage() {
64          return _parentMessage;
65      }
66  
67      public MBThread getPreviousThread() {
68          return _previousThread;
69      }
70  
71      public MBThread getThread() {
72          return _thread;
73      }
74  
75      public String getThreadView() {
76          return _threadView;
77      }
78  
79      public MBTreeWalker getTreeWalker() {
80          return _treeWalker;
81      }
82  
83      private MBCategory _category;
84      private MBMessage _message;
85      private MBThread _nextThread;
86      private MBMessage _parentMessage;
87      private MBThread _previousThread;
88      private MBThread _thread;
89      private String _threadView;
90      private MBTreeWalker _treeWalker;
91  
92  }