コード例 #1
0
  protected PortletWindowData getOrCreateDefaultPortletWindowData(
      HttpServletRequest request,
      IPortletEntityId portletEntityId,
      IPortletWindowId portletWindowId,
      IPortletWindowId delegationParentId) {
    // Sync on session map to make sure duplicate PortletWindowData is never created
    final PortletWindowCache<PortletWindowData> portletWindowDataMap =
        getPortletWindowDataMap(request);
    // Check if there portlet window data cached in the session
    PortletWindowData portletWindowData = portletWindowDataMap.getWindow(portletWindowId);
    if (portletWindowData != null) {
      logger.trace(
          "Found PortletWindowData {} in session cache", portletWindowData.getPortletWindowId());
      return portletWindowData;
    }

    // Create new window data for and initialize
    portletWindowData = new PortletWindowData(portletWindowId, portletEntityId, delegationParentId);
    this.initializePortletWindowData(request, portletWindowData);

    // Store in the session cache
    portletWindowData = portletWindowDataMap.storeIfAbsentWindow(portletWindowData);
    logger.trace(
        "Created PortletWindowData {} and stored session cache, wrapping as IPortletWindow and returning",
        portletWindowData.getPortletWindowId());

    return portletWindowData;
  }
コード例 #2
0
  @Override
  public IPortletWindow createDelegatePortletWindow(
      HttpServletRequest request,
      IPortletEntityId portletEntityId,
      IPortletWindowId delegationParentId) {
    Validate.notNull(request, "request can not be null");
    Validate.notNull(portletEntityId, "portletEntityId can not be null");

    // TODO does a delegate portlet entity need some sort of special treatment or do we just assume
    // that the calling code is using one?

    final IPortletWindowId portletWindowId =
        this.getDefaultPortletWindowId(request, portletEntityId);

    final PortletWindowCache<IPortletWindow> portletWindowMap = getPortletWindowMap(request);

    // Check if there is portlet window cached in the request
    IPortletWindow portletWindow = portletWindowMap.getWindow(portletWindowId);
    if (portletWindow != null) {
      logger.trace("Found IPortletWindow {} in request cache", portletWindow.getPortletWindowId());
      return portletWindow;
    }

    final PortletWindowData portletWindowData =
        this.getOrCreateDefaultPortletWindowData(
            request, portletEntityId, portletWindowId, delegationParentId);
    portletWindow = wrapPortletWindowData(request, portletWindowData);
    if (portletWindow == null) {
      return null;
    }

    // Cache the wrapped window in the request
    return portletWindowMap.storeIfAbsentWindow(portletWindow);
  }
コード例 #3
0
  @Override
  public IPortletWindow getOrCreateDefaultPortletWindow(
      HttpServletRequest request, IPortletEntityId portletEntityId) {
    Validate.notNull(request, "request can not be null");
    Validate.notNull(portletEntityId, "portletEntityId can not be null");

    final IPortletWindowId portletWindowId =
        this.getDefaultPortletWindowId(request, portletEntityId);

    final PortletWindowCache<IPortletWindow> portletWindowMap = getPortletWindowMap(request);

    // Check if there is portlet window cached in the request
    IPortletWindow portletWindow = portletWindowMap.getWindow(portletWindowId);
    if (portletWindow != null) {
      logger.trace("Found IPortletWindow {} in request cache", portletWindow.getPortletWindowId());
      return portletWindow;
    }

    final PortletWindowData portletWindowData =
        this.getOrCreateDefaultPortletWindowData(request, portletEntityId, portletWindowId);
    portletWindow = wrapPortletWindowData(request, portletWindowData);
    if (portletWindow == null) {
      return null;
    }

    // Cache the wrapped window in the request
    return portletWindowMap.storeIfAbsentWindow(portletWindow);
  }
コード例 #4
0
  /* (non-Javadoc)
   * @see org.jasig.portal.portlet.registry.IPortletWindowRegistry#getPortletWindow(javax.servlet.http.HttpServletRequest, org.jasig.portal.portlet.om.IPortletWindowId)
   */
  @Override
  public IPortletWindow getPortletWindow(
      HttpServletRequest request, IPortletWindowId portletWindowId) {
    Validate.notNull(request, "request can not be null");
    Validate.notNull(portletWindowId, "portletWindowId can not be null");

    final PortletWindowCache<IPortletWindow> portletWindowMap = getPortletWindowMap(request);

    IPortletWindow portletWindow = portletWindowMap.getWindow(portletWindowId);
    if (portletWindow != null) {
      logger.trace("Found IPortletWindow {} in request cache", portletWindow.getPortletWindowId());
      return portletWindow;
    }

    final PortletWindowIdImpl localPortletWindowId =
        this.convertPortletWindowId(request, portletWindowId);

    // Find the window data from the correct window data map
    final PortletWindowData portletWindowData;
    if (STATELESS_PORTLET_WINDOW_ID.equals(localPortletWindowId.getWindowInstanceId())) {
      final PortletWindowCache<PortletWindowData> statelessPortletWindowDataMap =
          this.getStatelessPortletWindowDataMap(request, false);
      if (statelessPortletWindowDataMap != null) {
        portletWindowData = statelessPortletWindowDataMap.getWindow(portletWindowId);
      } else {
        portletWindowData = null;
      }
    } else {
      portletWindowData = this.getPortletWindowData(request, portletWindowId);
    }

    if (portletWindowData == null) {
      logger.trace("No IPortletWindow {} exists, returning null");
      return null;
    }

    portletWindow = this.wrapPortletWindowData(request, portletWindowData);

    // Cache the wrapped window in the request
    return portletWindowMap.storeIfAbsentWindow(portletWindow);
  }
コード例 #5
0
  protected PortletWindowData getPortletWindowData(
      HttpServletRequest request, IPortletWindowId portletWindowId) {
    final PortletWindowCache<PortletWindowData> portletWindowDataMap =
        getPortletWindowDataMap(request, false);
    if (portletWindowDataMap == null) {
      return null;
    }

    final PortletWindowData portletWindowData = portletWindowDataMap.getWindow(portletWindowId);
    if (portletWindowData == null) {
      logger.trace("No PortletWindowData {} in session cache", portletWindowId);
      return null;
    }

    logger.trace(
        "Found PortletWindowData {} in session cache", portletWindowData.getPortletWindowId());
    return portletWindowData;
  }