}
public boolean doChannelAction(HttpServletRequest request, HttpServletResponse response, String channelSubscribeId, boolean noTimeout) throws PortalException {
// see if the channel has already been instantiated
// see if the channel is cached
IUserLayoutNodeDescription node = userPreferencesManager.getUserLayoutManager().getNode(channelSubscribeId);
if (!(node instanceof IUserLayoutChannelDescription)) {
throw new PortalException("'" + channelSubscribeId + "' is not a channel node !");
}
final IUserLayoutChannelDescription channel = (IUserLayoutChannelDescription) node;
final long timeOut = channel.getTimeout();
IChannel ch = channelTable.get(channelSubscribeId);
final IChannel originalChannel = ch;
if (ch == null || ch instanceof CSecureInfo) {
try {
ch = instantiateChannel(request, response, channel);
}
catch (Throwable e) {
ch = replaceWithErrorChannel(request, response, channelSubscribeId, ErrorCode.SET_STATIC_DATA_EXCEPTION, e, null, false);
}
}
if (ch instanceof IPrivileged) {
ch = this.feedPortalControlStructuresToChannel(request, response, channelSubscribeId, (IPrivileged) ch);
}
//If the channel object has changed (likely now an error channel) return immediatly
if (originalChannel != null && originalChannel != ch) {
return false;
}
final ChannelRuntimeData runtimeData = this.getChannelRuntimeData(request, channelSubscribeId, RequestType.ACTION);
// Build a new channel renderer instance.
final IChannelRenderer channelRenderer = cChannelRendererFactory.newInstance(ch, runtimeData);
if (noTimeout) {
channelRenderer.setTimeout(0);
}
else {
channelRenderer.setTimeout(timeOut);
}
channelRenderer.startRendering();
final int renderingStatus;
try {
renderingStatus = channelRenderer.completeRendering();
}
catch (Throwable t) {
ch = replaceWithErrorChannel(request, response, channelSubscribeId, ErrorCode.RENDER_TIME_EXCEPTION, t, null, false);
log.error("Failed to complete action", t);
return false;
}
if (renderingStatus != IChannelRenderer.RENDERING_SUCCESSFUL) {
final ErrorCode errorCode;
if (renderingStatus == IChannelRenderer.RENDERING_TIMED_OUT) {
errorCode = ErrorCode.TIMEOUT_EXCEPTION;
}
else {
errorCode = ErrorCode.GENERAL_ERROR;
}
ch = replaceWithErrorChannel(request, response, channelSubscribeId, errorCode, null, "unsuccessful rendering", true);
log.error("Action did not compplete successefully: " + renderingStatus);
return false;
}
// Obtain the channel description
IUserLayoutChannelDescription channelDesc = null;
IUserLayoutNodeDescription parentNode = null;
try {
final IUserLayoutManager userLayoutManager = userPreferencesManager.getUserLayoutManager();
channelDesc = (IUserLayoutChannelDescription) userLayoutManager.getNode(channelSubscribeId);
final String parentNodeId = userLayoutManager.getParentId(channelDesc.getId());