Examples of PortletEntry


Examples of org.apache.jetspeed.om.registry.PortletEntry

        try
        {

            // Retrieve registry entry
            PortletEntry entry =
                (PortletEntry) Registry.getEntry(Registry.PORTLET, portletName);

            // Verify security for the parameter
            boolean canAccess =
                JetspeedSecurity.checkPermission(
View Full Code Here

Examples of org.apache.jetspeed.om.registry.PortletEntry

                            parmName,
                            "");
                }

                // Retrieve registry entry and its parameter
                PortletEntry entry =
                    (PortletEntry) Registry.getEntry(
                        Registry.PORTLET,
                        portlet.getName());
                Parameter param = entry.getParameter(parmName);
                if (param == null)
                {
                    throw new Exception(
                        "Parameter [" + parmName + "] was not found");
                }

                // Verify security for the parameter
                boolean canAccess =
                    JetspeedSecurity.checkPermission(
                        (JetspeedUser) data.getUser(),
                        new PortalResource(entry, param),
                        JetspeedSecurity.PERMISSION_CUSTOMIZE);

        // If security does not allow access to specific parameter, allow to provide a fallback parameter
        if (canAccess == false)
                {
                    ParameterStyle ps = param.getParameterStyle();
                    String parmNameNoAccess = null;
                    if (ps == null)
                    {
                        parmNameNoAccess =
                            portlet.getPortletConfig().getInitParameter(
                                parmName + ".style.no-access");
                    }
                    else
                    {
                        StyleOption noaccess = ps.getOption("no-access");
                        if (noaccess != null)
                        {
                            parmNameNoAccess = noaccess.getValue();
                        }
                    }
                    if (parmNameNoAccess != null)
                    {
                        if (logger.isDebugEnabled())
                        {
                            logger.debug(
                                "JetspeedTool: access to parm ["
                                    + parmName
                                    + "] disallowed, redirecting to parm ["
                                    + parmNameNoAccess
                                    + "]");
                        }
                        parmName = parmNameNoAccess;
            param = entry.getParameter(parmName);
            if (param == null)
            {
              throw new Exception(
                "No access parameter [" + parmName + "] was not found");
            }
View Full Code Here

Examples of org.apache.jetspeed.om.registry.PortletEntry

        Enumeration portlets = Registry.get( Registry.PORTLET ).getEntries();

        while ( portlets.hasMoreElements() ) {

            PortletEntry entry = (PortletEntry)portlets.nextElement();

            if ( entry.isApplication() )
            {
                applications.addElement(entry);
            }
        }
View Full Code Here

Examples of org.apache.jetspeed.om.registry.PortletEntry

        Table table = new Table();
        Enumeration portlets = applications.elements();

        while ( portlets.hasMoreElements() ) {

            PortletEntry entry = (PortletEntry)portlets.nextElement();
           
            String url = PortletURIManager.getPortletMaxURI( entry, data ).toString();
            Portlet portlet = null;
            try {
                portlet = PortletFactory.getPortlet(entry.getName(), "0");
            } catch (PortletException e) {
                continue;
            }
            A anchor = new A( url ).addElement( portlet.getTitle() );
            table.addElement( new TR().addElement( new TD().addElement( anchor ) ) );
View Full Code Here

Examples of org.apache.jetspeed.om.registry.PortletEntry

            // Add rundata out of convenience (JspService.RUNDATA differs from GenericMVCPortlet.RUNDATA)
            request.setAttribute(JspService.RUNDATA, data);

            // Retrieve the URL. For backward compatibility, use the URL first
            // and then fallback to "template" parameter
            PortletEntry pe = (PortletEntry) Registry.getEntry(Registry.PORTLET, portlet.getName());

            // Files referenced from default templates folder will be processed
            // using JspService. Otherwise, they will be loaded using EcsServletElement
            // from where ever they came from.
            if (pe.getURL() == null || pe.getURL().trim().length() == 0)
            {

                if (template != null && -1 == template.indexOf(".jsp"))
                {
                    template = template + ".jsp";
                }

                logger.info("JSPViewProcessor - locating template - " + data.toString()
                         + " - " + template);

                //we use the template locator to translate the template
                String locatedTemplate = TemplateLocator.locatePortletTemplate(data, template);
                logger.info("JSPViewProcessor - located template: " + locatedTemplate);

                /*if (locatedTemplate == null)
                {
                    locatedTemplate = TemplateLocator.locateScreenTemplate(data, template);
                    if (locatedTemplate != null)
                    {
                        locatedTemplate = "/screens" + locatedTemplate;
                    }
                    logger.debug("JSPViewProcessor - located screen template: " + locatedTemplate);
                } */

                JetspeedJspService service = (JetspeedJspService) ServiceUtil.getServiceByName(JspService.SERVICE_NAME);

                // this is only necessary if we don't run in a JSP page environment
                // but better be safe than sorry...
                service.addDefaultObjects(data);

                // handle request
                result = service.handleBufferedRequest(data, locatedTemplate, false);

            }
            else
            {
                // Build parameter list to be passed with the jsp
                Iterator names = portlet.getPortletConfig().getInitParameterNames();
                while (names.hasNext())
                {
                    String name = (String) names.next();
                    String value = (String) portlet.getPortletConfig().getInitParameter(name);
                    data.getParameters().setString(name, value);
                }

                template = pe.getURL();

                if (logger.isDebugEnabled())
                {
                    logger.debug("JSPViewProcessor - serving jsp directly using: " + template);
                }
View Full Code Here

Examples of org.apache.jetspeed.om.registry.PortletEntry

     * Utility method for retreiving the correct security reference based
     * on profile and registry information.
     */
    public static SecurityReference getSecurityReference(Entry entry,  JetspeedRunData rundata)
    {
        PortletEntry pEntry = null;
        if (entry != null)
        {
            pEntry = (PortletEntry) Registry.getEntry(Registry.PORTLET, entry.getParent());
        }
        SecurityReference securityRef = null;
        // First, check the profile level security
        if (entry != null)
        {
            securityRef = entry.getSecurityRef();
        }

        // If no profile level security has been assigned, use the registry
        if (securityRef == null && pEntry != null)
        {
            securityRef = pEntry.getSecurityRef();
        }

        // still no security? go with the default.
        if (securityRef == null && rundata != null)
        {
View Full Code Here

Examples of org.apache.jetspeed.om.registry.PortletEntry

     *   <li><b>2</b> if the 2 previous assertion are false (inheriting)</li>
     * </ul>
     */
    public static  int getSecuritySource(Entry entry,  JetspeedRunData rundata)
    {
        PortletEntry pEntry = (PortletEntry) Registry.getEntry(Registry.PORTLET, entry.getParent());
        if (entry.getSecurityRef() != null)
        {
            return 0;
        }

        if (pEntry != null && pEntry.getSecurityRef() != null)
        {
            return 1;
        }

        return 2;
View Full Code Here

Examples of org.apache.jetspeed.om.registry.PortletEntry

            // Add rundata out of convenience (JspService.RUNDATA differs from GenericMVCPortlet.RUNDATA)
            request.setAttribute(JspService.RUNDATA, data);

            // Retrieve the URL. For backward compatibility, use the URL first
            // and then fallback to "template" parameter
            PortletEntry pe = (PortletEntry) Registry.getEntry(Registry.PORTLET, portlet.getName());

            // Files referenced from default templates folder will be processed
            // using JspService. Otherwise, they will be loaded using EcsServletElement
            // from where ever they came from.
            if (pe.getURL() == null || pe.getURL().trim().length() == 0)
            {

                if (template != null && -1 == template.indexOf(".jsp"))
                {
                    template = template + ".jsp";
                }

                logger.info("JSPViewProcessor - locating template - " + data.toString()
                         + " - " + template);

                //we use the template locator to translate the template
                String locatedTemplate = TemplateLocator.locatePortletTemplate(data, template);
                logger.info("JSPViewProcessor - located template: " + locatedTemplate);

                /*if (locatedTemplate == null)
                {
                    locatedTemplate = TemplateLocator.locateScreenTemplate(data, template);
                    if (locatedTemplate != null)
                    {
                        locatedTemplate = "/screens" + locatedTemplate;
                    }
                    logger.debug("JSPViewProcessor - located screen template: " + locatedTemplate);
                } */

                JspService service = (JspService) ServiceUtil.getServiceByName(JspService.SERVICE_NAME);

                // this is only necessary if we don't run in a JSP page environment
                // but better be safe than sorry...
                service.addDefaultObjects(data);

                // handle request
                service.handleRequest(data, locatedTemplate);

            }
            else
            {
                // Build parameter list to be passed with the jsp
                Iterator names = portlet.getPortletConfig().getInitParameterNames();
                while (names.hasNext())
                {
                    String name = (String) names.next();
                    String value = (String) portlet.getPortletConfig().getInitParameter(name);
                    data.getParameters().setString(name, value);
                }

                template = pe.getURL();

                if (logger.isDebugEnabled())
                {
                    logger.debug("JSPViewProcessor - serving jsp directly using: " + template);
                }
View Full Code Here

Examples of org.apache.jetspeed.om.registry.PortletEntry

    private static final JetspeedLogger logger = JetspeedLogFactoryService
            .getLogger(PortletDbEntryPeer.class.getName());

    public static PortletEntry lookupPortletEntry(String entryName)
    {
        PortletEntry pe = null;
        try
        {
            PortletDbEntry pde = lookup(entryName);
            if (pde != null)
            {
View Full Code Here

Examples of org.apache.jetspeed.om.registry.PortletEntry

    }

    public static PortletEntry mapDatabaseToEntry(PortletDbEntry pde)
            throws TorqueException
    {
        PortletEntry pe = new BasePortletEntry(pde.getId());
        pe.setApplication(pde.getApplication());
        pe.setCachedOnURL(pde.getCachedOnUrl());
        pe.setClassname(pde.getClassname());
        pe.setDescription(pde.getDescription());
        pe.setHidden(pde.getHidden());
        MetaInfo meta = new BaseMetaInfo();
        meta.setImage(pde.getImage());
        meta.setDescription(pde.getDescription());
        meta.setTitle(pde.getTitle());
        pe.setMetaInfo(meta);               
        pe.setName(pde.getName());           
        pe.setParent(pde.getParent());
        if(pde.getSecurityRef() != null)
        {
            SecurityReference ref = new BaseSecurityReference();
            ref.setParent(pde.getSecurityRef());
            pe.setSecurityRef(ref);
        }

        pe.setTitle(pde.getTitle());
        pe.setType(pde.getType());
        pe.setURL(pde.getURL());
       
        // parameters
        Iterator params = pde.getPortletParameters().iterator();
        while (params.hasNext())
        {
            PortletParameter pp = (PortletParameter)params.next();
            CachedParameter cp = new BaseCachedParameter(pp.getId());
            cp.setCachedOnName(pp.getCachedOnName());
            cp.setCachedOnValue(pp.getCachedOnValue());
            cp.setDescription(pp.getDescription());
            cp.setHidden(pp.getHidden());
            cp.setName(pp.getName());
            cp.setType(pp.getType());
            cp.setValue(pp.getValue());

           
            cp.setTitle(pp.getTitle());
            if (pp.getDescription() != null || pp.getTitle() != null || pp.getImage() != null)
            {
                MetaInfo meta2 = new BaseMetaInfo();
                meta2.setImage(pp.getImage());
                meta2.setDescription(pp.getDescription());
                meta2.setTitle(pp.getTitle());
                cp.setMetaInfo(meta2);
            }
            if (pp.getSecurityRef() != null)
            {
                SecurityReference ref2 = new BaseSecurityReference();
                ref2.setParent(pp.getSecurityRef());
                cp.setSecurityRef(ref2);
            }           
            pe.addParameter(cp);
        }
       
        // media types
        Iterator mtypes = pde.getPortletMediatypes().iterator();
        while (mtypes.hasNext())
        {
            PortletMediatype pm = (PortletMediatype)mtypes.next();
            pe.addMediaType(pm.getName());
        }

        // categories
        Iterator categories = pde.getPortletCategorys().iterator();
        while (categories.hasNext())
        {
            PortletCategory pc = (PortletCategory)categories.next();           
            pe.addCategory(pc.getName(), pc.getGroup());
        }
       
        return pe;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.