001    /**
002     * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
013     */
014    
015    package com.liferay.portal.kernel.poller;
016    
017    import com.liferay.portal.kernel.util.StringBundler;
018    
019    /**
020     * @author Brian Wing Shun Chan
021     */
022    public class PollerHeader {
023    
024            public PollerHeader(
025                    long companyId, long userId, long browserKey, String[] portletIds,
026                    boolean initialRequest, boolean startPolling) {
027    
028                    _companyId = companyId;
029                    _userId = userId;
030                    _browserKey = browserKey;
031                    _portletIds = portletIds;
032                    _initialRequest = initialRequest;
033                    _startPolling = startPolling;
034            }
035    
036            public long getBrowserKey() {
037                    return _browserKey;
038            }
039    
040            public long getCompanyId() {
041                    return _companyId;
042            }
043    
044            public String[] getPortletIds() {
045                    return _portletIds;
046            }
047    
048            public long getTimestamp() {
049                    return _timestamp;
050            }
051    
052            public long getUserId() {
053                    return _userId;
054            }
055    
056            public boolean isInitialRequest() {
057                    return _initialRequest;
058            }
059    
060            public boolean isStartPolling() {
061                    return _startPolling;
062            }
063    
064            public String toString() {
065                    StringBundler sb = new StringBundler(13);
066    
067                    sb.append("{_browserKey=");
068                    sb.append(_browserKey);
069                    sb.append(", companyId=");
070                    sb.append(_companyId);
071                    sb.append(", initialRequest=");
072                    sb.append(_initialRequest);
073                    sb.append(", portletIds=");
074                    sb.append(_portletIds);
075                    sb.append(", startPolling=");
076                    sb.append(_startPolling);
077                    sb.append(", timestamp=");
078                    sb.append(_timestamp);
079                    sb.append(", userId=");
080                    sb.append(_userId);
081                    sb.append("}");
082    
083                    return sb.toString();
084            }
085    
086            private long _browserKey;
087            private long _companyId;
088            private boolean _initialRequest;
089            private String[] _portletIds;
090            private boolean _startPolling;
091            private long _timestamp = System.currentTimeMillis();
092            private long _userId;
093    
094    }