com.liferay.portal.kernel.poller.PollerRequest Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of portal-service Show documentation
Show all versions of portal-service Show documentation
Contains interfaces for the portal services. Interfaces are only loaded by the global class loader and are shared by all plugins.
/**
* Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or (at your option)
* any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*/
package com.liferay.portal.kernel.poller;
import com.liferay.portal.kernel.util.StringBundler;
import com.liferay.portal.kernel.util.Validator;
import java.util.Collections;
import java.util.Map;
import java.util.Set;
import javax.servlet.http.HttpServletRequest;
/**
* @author Brian Wing Shun Chan
*/
public class PollerRequest {
public PollerRequest(
HttpServletRequest request, PollerHeader pollerHeader, String portletId,
Map parameterMap, String chunkId,
boolean receiveRequest) {
_request = request;
_pollerHeader = pollerHeader;
_portletId = portletId;
_parameterMap = parameterMap;
_chunkId = chunkId;
_receiveRequest = receiveRequest;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof PollerRequest)) {
return false;
}
PollerRequest portletRequest = (PollerRequest)obj;
if (Validator.equals(_portletId, portletRequest._portletId)) {
return true;
}
return false;
}
public long getBrowserKey() {
return _pollerHeader.getBrowserKey();
}
public String getChunkId() {
return _chunkId;
}
public long getCompanyId() {
return _pollerHeader.getCompanyId();
}
public Map getParameterMap() {
return _parameterMap;
}
public PollerHeader getPollerHeader() {
return _pollerHeader;
}
public String getPortletId() {
return _portletId;
}
public Set getPortletIds() {
Map portletIdsMap = _pollerHeader.getPortletIdsMap();
return portletIdsMap.keySet();
}
public HttpServletRequest getRequest() {
return _request;
}
public long getTimestamp() {
return _pollerHeader.getTimestamp();
}
public long getUserId() {
return _pollerHeader.getUserId();
}
@Override
public int hashCode() {
if (_portletId != null) {
return _portletId.hashCode();
}
else {
return 0;
}
}
public boolean isInitialRequest() {
Map portletIdsMap = _pollerHeader.getPortletIdsMap();
return portletIdsMap.get(_portletId);
}
public boolean isReceiveRequest() {
return _receiveRequest;
}
public boolean isStartPolling() {
return _pollerHeader.isStartPolling();
}
@Override
public String toString() {
StringBundler sb = new StringBundler(11);
sb.append("{chunkId=");
sb.append(_chunkId);
sb.append(", parameterMap=");
sb.append(_parameterMap);
sb.append(", pollerHeader=");
sb.append(_pollerHeader);
sb.append(", portletId=");
sb.append(_portletId);
sb.append(", receiveRequest=");
sb.append(_receiveRequest);
sb.append("}");
return sb.toString();
}
private String _chunkId;
private Map _parameterMap = Collections.emptyMap();
private PollerHeader _pollerHeader;
private String _portletId;
private boolean _receiveRequest;
private HttpServletRequest _request;
}