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.portal.kernel.poller;
16  
17  import com.liferay.portal.kernel.util.StringBundler;
18  
19  /**
20   * <a href="PollerHeader.java.html"><b><i>View Source</i></b></a>
21   *
22   * @author Brian Wing Shun Chan
23   */
24  public class PollerHeader {
25  
26      public PollerHeader(
27          long userId, long browserKey, String[] portletIds,
28          boolean initialRequest, boolean startPolling) {
29  
30          _userId = userId;
31          _browserKey = browserKey;
32          _portletIds = portletIds;
33          _initialRequest = initialRequest;
34          _startPolling = startPolling;
35      }
36  
37      public long getBrowserKey() {
38          return _browserKey;
39      }
40  
41      public String[] getPortletIds() {
42          return _portletIds;
43      }
44  
45      public long getTimestamp() {
46          return _timestamp;
47      }
48  
49      public long getUserId() {
50          return _userId;
51      }
52  
53      public boolean isInitialRequest() {
54          return _initialRequest;
55      }
56  
57      public boolean isStartPolling() {
58          return _startPolling;
59      }
60  
61      public String toString() {
62          StringBundler sb = new StringBundler(13);
63  
64          sb.append("{_browserKey=");
65          sb.append(_browserKey);
66          sb.append(", initialRequest=");
67          sb.append(_initialRequest);
68          sb.append(", portletIds=");
69          sb.append(_portletIds);
70          sb.append(", startPolling=");
71          sb.append(_startPolling);
72          sb.append(", timestamp=");
73          sb.append(_timestamp);
74          sb.append(", userId=");
75          sb.append(_userId);
76          sb.append("}");
77  
78          return sb.toString();
79      }
80  
81      private long _browserKey;
82      private boolean _initialRequest;
83      private String[] _portletIds;
84      private boolean _startPolling;
85      private long _timestamp = System.currentTimeMillis();
86      private long _userId;
87  
88  }