Java Code Examples for javax.portlet.PortletMode#toString()

The following examples show how to use javax.portlet.PortletMode#toString() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PortletRequestImpl.java    From portals-pluto with Apache License 2.0 5 votes vote down vote up
@Override
public boolean isPortletModeAllowed(PortletMode mode) {
   if (PortletMode.VIEW.equals(mode)) {
      return true;
   }

   String modeName = mode.toString();

   PortletDefinition dd = getPortletWindow().getPortletDefinition();

   for (Supports sup : dd.getSupports()) {
      for (String m : sup.getPortletModes()) {
         if (m.equalsIgnoreCase(modeName)) {
            // check if a portlet managed mode which is always allowed.
            CustomPortletMode cpm = dd.getApplication().getCustomPortletMode(modeName);
            if (cpm != null && !cpm.isPortalManaged()) {
               return true;
            }
            Enumeration<PortletMode> supportedModes = portalContext.getSupportedPortletModes();
            while (supportedModes.hasMoreElements()) {
               if (supportedModes.nextElement().equals(mode)) {
                  return true;
               }
            }
            return false;
         }
      }
   }
   return false;
}
 
Example 2
Source File: PortletResponseImpl.java    From portals-pluto with Apache License 2.0 5 votes vote down vote up
protected boolean isPortletModeAllowed(PortletMode mode)
{
    if(PortletMode.VIEW.equals(mode))
    {
        return true;
    }
    
    String modeName = mode.toString();

    PortletDefinition dd = getPortletWindow().getPortletDefinition();

    for (Supports sup : dd.getSupports())
    {
        for (String m : sup.getPortletModes())
        {
            if (m.equalsIgnoreCase(modeName)) 
            {
                // check if a portlet managed mode which is always allowed.
                CustomPortletMode cpm = dd.getApplication().getCustomPortletMode(modeName);
                if (cpm != null && !cpm.isPortalManaged())
                {
                    return true;
                }
                Enumeration<PortletMode> supportedModes = getPortalContext().getSupportedPortletModes();
                while (supportedModes.hasMoreElements()) 
                {
                    if (supportedModes.nextElement().equals(mode)) 
                    {
                        return true;
                    }
                }
                return false;
            }
        }
    }
    return false;
}
 
Example 3
Source File: PortletURLImpl.java    From portals-pluto with Apache License 2.0 5 votes vote down vote up
private boolean isPortletModeAllowed(PortletMode mode) {
   if (PortletMode.VIEW.equals(mode)) {
      return true;
   }

   String modeName = mode.toString();

   PortletDefinition dd = responseContext.getPortletWindow()
         .getPortletDefinition();

   for (Supports sup : dd.getSupports()) {
      for (String m : sup.getPortletModes()) {
         if (m.equalsIgnoreCase(modeName)) {
            // check if a portlet managed mode which is always allowed.
            CustomPortletMode cpm = dd.getApplication()
                  .getCustomPortletMode(modeName);
            if (cpm != null && !cpm.isPortalManaged()) {
               return true;
            }
            Enumeration<PortletMode> supportedModes = portalContext
                  .getSupportedPortletModes();
            while (supportedModes.hasMoreElements()) {
               if (supportedModes.nextElement().equals(mode)) {
                  return true;
               }
            }
            return false;
         }
      }
   }
   return false;
}