001    /**
002     * Copyright (c) 2000-2012 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
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    }