package org.jasig.portal.rendering.predicates;

import com.google.common.base.Predicate;
import org.jasig.portal.url.IPortalRequestInfo;
import org.jasig.portal.url.IUrlSyntaxProvider;
import org.jasig.portal.url.UrlState;
import org.springframework.beans.factory.annotation.Autowired;

import javax.servlet.http.HttpServletRequest;

/**
 * Answers whether a given HttpServletRequest represents one that the rendering pipeline will focus on rendering just
 * one portlet (e.g., maximized, or exclusive).
 * @since uPortal 4.2
 */
public class FocusedOnOnePortletPredicate
    implements Predicate<HttpServletRequest> {

    // auto-wired.
    private IUrlSyntaxProvider urlSyntaxProvider;

    @Override
    public boolean apply(final HttpServletRequest request) {

        final IPortalRequestInfo portalRequestInfo = this.urlSyntaxProvider.getPortalRequestInfo(request);

        // true when there is a portal request and that request is not for a portal in NORMAL state
        // i.e. portal is in some other state, like Maximized or Exclusive or Detached.
        // false otherwise. False when portalRequestInfo is null because unknown portal state is not
        // focused-on-one-portlet portal state.
        return (null != portalRequestInfo &&
                ! (UrlState.NORMAL.equals(portalRequestInfo.getUrlState())));
    }

    @Autowired
    public void setUrlSyntaxProvider(IUrlSyntaxProvider urlSyntaxProvider) {
        this.urlSyntaxProvider = urlSyntaxProvider;
    }
}

package org.jasig.portal.rendering.predicates;

import com.google.common.base.Predicate;
import org.jasig.portal.url.IPortalRequestInfo;
import org.jasig.portal.url.IUrlSyntaxProvider;
import org.jasig.portal.url.UrlState;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;

import javax.servlet.http.HttpServletRequest;

/**
 * Answers whether a given HttpServletRequest represents one that the rendering pipeline will focus on rendering just
 * one portlet (e.g., maximized, or exclusive).
 * @since uPortal 4.2
 */
public class FocusedOnOnePortletPredicate
    implements Predicate<HttpServletRequest> {

    protected final Logger logger = LoggerFactory.getLogger(getClass());

    // auto-wired.
    private IUrlSyntaxProvider urlSyntaxProvider;

    @Override
    public boolean apply(final HttpServletRequest request) {

        final IPortalRequestInfo portalRequestInfo = this.urlSyntaxProvider.getPortalRequestInfo(request);

        if (null == portalRequestInfo) {
            logger.warn("Portal request info was not available for this request, " +
                    "so assuming that it does not represent focus on one portlet.");
            // False when portalRequestInfo is null because unknown portal state is not
            // focused-on-one-portlet portal state.
            return false;
        }

        final UrlState urlState = portalRequestInfo.getUrlState();

        // true when there is a portal request and that request is not for a portal in NORMAL state
        // i.e. portal is in some other state, like Maximized or Exclusive or Detached.
        // false otherwise.
        final boolean doesRequestFocusOnOnePortlet = (! (UrlState.NORMAL.equals(urlState)));

        logger.debug("Determined request with UrlState {} {} focus on one portlet.",
                urlState,
                doesRequestFocusOnOnePortlet ? "does" : "does not");

        return doesRequestFocusOnOnePortlet;
    }

    @Autowired
    public void setUrlSyntaxProvider(IUrlSyntaxProvider urlSyntaxProvider) {
        this.urlSyntaxProvider = urlSyntaxProvider;
    }
}

Add logging in FocusedOnOnePortletPredicate.