001    /**
002     * Copyright (c) 2000-2013 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    import java.util.Map;
020    
021    /**
022     * @author Brian Wing Shun Chan
023     */
024    public class PollerHeader {
025    
026            public PollerHeader(
027                    long companyId, long userId, long browserKey,
028                    Map<String, Boolean> portletIdsMap, boolean startPolling) {
029    
030                    _companyId = companyId;
031                    _userId = userId;
032                    _browserKey = browserKey;
033                    _portletIdsMap = portletIdsMap;
034                    _startPolling = startPolling;
035            }
036    
037            public long getBrowserKey() {
038                    return _browserKey;
039            }
040    
041            public long getCompanyId() {
042                    return _companyId;
043            }
044    
045            public Map<String, Boolean> getPortletIdsMap() {
046                    return _portletIdsMap;
047            }
048    
049            public long getTimestamp() {
050                    return _timestamp;
051            }
052    
053            public long getUserId() {
054                    return _userId;
055            }
056    
057            public boolean isStartPolling() {
058                    return _startPolling;
059            }
060    
061            @Override
062            public String toString() {
063                    StringBundler sb = new StringBundler(13);
064    
065                    sb.append("{_browserKey=");
066                    sb.append(_browserKey);
067                    sb.append(", companyId=");
068                    sb.append(_companyId);
069                    sb.append(", portletIdsMap=");
070                    sb.append(_portletIdsMap);
071                    sb.append(", startPolling=");
072                    sb.append(_startPolling);
073                    sb.append(", timestamp=");
074                    sb.append(_timestamp);
075                    sb.append(", userId=");
076                    sb.append(_userId);
077                    sb.append("}");
078    
079                    return sb.toString();
080            }
081    
082            private long _browserKey;
083            private long _companyId;
084            private Map<String, Boolean> _portletIdsMap;
085            private boolean _startPolling;
086            private long _timestamp = System.currentTimeMillis();
087            private long _userId;
088    
089    }