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.comet;
016    
017    import com.liferay.portal.util.PortalUtil;
018    
019    import javax.servlet.http.HttpServletRequest;
020    
021    /**
022     * @author Edward Han
023     * @author Brian Wing Shun Chan
024     */
025    public abstract class BaseCometRequest implements CometRequest {
026    
027            public long getCompanyId() {
028                    return _companyId;
029            }
030    
031            public String getPathInfo() {
032                    return _pathInfo;
033            }
034    
035            public HttpServletRequest getRequest() {
036                    return _request;
037            }
038    
039            public long getTimestamp() {
040                    return _timestamp;
041            }
042    
043            public long getUserId() {
044                    return _userId;
045            }
046    
047            public void setCompanyId(long companyId) {
048                    _companyId = companyId;
049            }
050    
051            public void setPathInfo(String pathInfo) {
052                    _pathInfo = pathInfo;
053            }
054    
055            public void setRequest(HttpServletRequest request) {
056                    setCompanyId(PortalUtil.getCompanyId(request));
057                    setPathInfo(request.getPathInfo());
058                    setUserId(PortalUtil.getUserId(request));
059            }
060    
061            public void setTimestamp(long timestamp) {
062                    _timestamp = timestamp;
063            }
064    
065            public void setUserId(long userId) {
066                    _userId = userId;
067            }
068    
069            private long _companyId;
070            private String _pathInfo;
071            private HttpServletRequest _request;
072            private long _timestamp = System.currentTimeMillis();
073            private long _userId;
074    
075    }