001    /**
002     * Copyright (c) 2000-2011 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            @Override
065            public String toString() {
066                    StringBundler sb = new StringBundler(13);
067    
068                    sb.append("{_browserKey=");
069                    sb.append(_browserKey);
070                    sb.append(", companyId=");
071                    sb.append(_companyId);
072                    sb.append(", initialRequest=");
073                    sb.append(_initialRequest);
074                    sb.append(", portletIds=");
075                    sb.append(_portletIds);
076                    sb.append(", startPolling=");
077                    sb.append(_startPolling);
078                    sb.append(", timestamp=");
079                    sb.append(_timestamp);
080                    sb.append(", userId=");
081                    sb.append(_userId);
082                    sb.append("}");
083    
084                    return sb.toString();
085            }
086    
087            private long _browserKey;
088            private long _companyId;
089            private boolean _initialRequest;
090            private String[] _portletIds;
091            private boolean _startPolling;
092            private long _timestamp = System.currentTimeMillis();
093            private long _userId;
094    
095    }