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