ICEfaces
  1. ICEfaces
  2. ICE-2118

DnDCache instance uses only the current portlet as context

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.6.1
    • Fix Version/s: 1.7DR#3, 1.7
    • Component/s: ICE-Components
    • Labels:
      None
    • Environment:
      Portal(Liferay)
    • Workaround Exists:
      Yes
    • Workaround Description:
      Hide
      I've managed to solve this by placing the key into the application session, not portlet session so all portlets would share the same DnDCache. Here's the code:

      public static DnDCache getInstance(FacesContext context, boolean encoding) {
              PortletSession portletSession = (PortletSession)context.getExternalContext().getSession(false);

              DnDCache cache = (DnDCache) portletSession.getAttribute(SESSION_KEY,PortletSession.APPLICATION_SCOPE);
              if (cache == null) {
                  cache = new DnDCache();
                  portletSession.setAttribute(SESSION_KEY, cache, PortletSession.APPLICATION_SCOPE);
              }
              return cache;
          }

      However, this code is not yet standardized to your current structure to use portal context detection, so if you run this in a servlet environment it would not work.

      It would be nice if you could look into it and if you consider it's a good solution, make the necessary adjustments or comments on my ideea.

      Thanks,

          Dan Leahu.
      Show
      I've managed to solve this by placing the key into the application session, not portlet session so all portlets would share the same DnDCache. Here's the code: public static DnDCache getInstance(FacesContext context, boolean encoding) {         PortletSession portletSession = (PortletSession)context.getExternalContext().getSession(false);         DnDCache cache = (DnDCache) portletSession.getAttribute(SESSION_KEY,PortletSession.APPLICATION_SCOPE);         if (cache == null) {             cache = new DnDCache();             portletSession.setAttribute(SESSION_KEY, cache, PortletSession.APPLICATION_SCOPE);         }         return cache;     } However, this code is not yet standardized to your current structure to use portal context detection, so if you run this in a servlet environment it would not work. It would be nice if you could look into it and if you consider it's a good solution, make the necessary adjustments or comments on my ideea. Thanks,     Dan Leahu.

      Description

      ------------------- DnDCache.java
      public static DnDCache getInstance(FacesContext context, boolean encoding) {
              String viewId = context.getViewRoot().getViewId();
              Map map = context.getExternalContext().getSessionMap();
              DnDCache cache = (DnDCache) map.get(SESSION_KEY);
              if (cache == null) {
                  cache = new DnDCache();
                  map.put(SESSION_KEY, cache);
              }
              return cache;
          }

      ------------------- ISSUE
      The instance taken using this method for the DnDCache is in the context of the current running portlet. Hence, if a drag was made from one portlet to another, the dragValue and dropValue properties would be null because the DnDCache instance is local to the source portlet.

        Activity

          People

          • Assignee:
            Unassigned
            Reporter:
            Dan Leahu
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: