Package org.apache.ecs

Examples of org.apache.ecs.ConcreteElement


    /**
    */
    public ConcreteElement getContent(RunData rundata)
    {
        ConcreteElement content = null;
        PortletController controller = getController();
        PortalResource portalResource = new PortalResource(this);

        try
        {
            JetspeedLink jsLink = JetspeedLinkFactory.getInstance(rundata);
            portalResource.setOwner(jsLink.getUserName());
            JetspeedLinkFactory.putInstance(jsLink);
        }
        catch (Exception e)
        {
            logger.warn(e.toString(), e);
            portalResource.setOwner(null);
        }

        if (!JetspeedSecurity.checkPermission((JetspeedUser) rundata.getUser()
                  portalResource, JetspeedSecurity.PERMISSION_VIEW))
        {  
            if ( logger.isDebugEnabled() )
            {
                logger.debug("Unauthorized access by user \"" + rundata.getUser().getUserName() + "\"");
            }
            // Clear any portlets that exist in this set
            if (this.portlets != null)
            {
                this.portlets.clear();
            }
            return new StringElement(Localization.getString(rundata, "SECURITY_NO_ACCESS"));
        }
        else
        {
            if ( logger.isDebugEnabled() )
            {
                logger.debug("User \"" + rundata.getUser().getUserName() + "\" is authorized to portlet set " + getID());
            }
        }
           
        if (controller == null)
        {
            Portlet p = getPortletAt(0);
   
            if (p != null)
            {
                content = p.getContent(rundata);
            }
        }
        else
        {
            content = controller.getContent(rundata);
        }

        if (content == null)
        {
            content = new ConcreteElement();
        }
       
        return content;
    }
View Full Code Here


        try
       
            pageContext.getOut().flush();

            ConcreteElement screenElement = ScreenLoader.getInstance().eval( data, screenName );

            // Check whether this is an "old" screen (that returns a ConcreteElement)
            // or a "new" one that returns null.
            if ( screenElement != null )
            {
                //The ECS element must serialize in the character encoding
                // of the response
                screenElement.setCodeSet( data.getResponse().getCharacterEncoding() );

                screenElement.output( data.getResponse().getWriter() );
            }

        }
    catch (Exception e)
        {
View Full Code Here

    {
        JetspeedRunData data = (JetspeedRunData) pageContext.getAttribute(JspService.RUNDATA, PageContext.REQUEST_SCOPE);
       
        try
        {
            ConcreteElement result = null;
            DynamicURI uri = null;
            ForwardService service = (ForwardService) ServiceUtil.getServiceByName(ForwardService.SERVICE_NAME);

            if (this.name != null && this.target != null)
            {
View Full Code Here

           
        try
       
            pageContext.getOut().flush();

            ConcreteElement result = new ConcreteElement();

            if (data != null && data.getUser() != null)
            {
                JetspeedTool jt = new JetspeedTool(data);
                String jspeid = (String) data.getUser().getTemp("js_peid");
                if (jspeid != null)
                {
                    data.setMode(JetspeedRunData.MAXIMIZE);
                    result = jt.getPortletById(jspeid);
                }
                else
                {
                    result = jt.getPane(this.name);
                }
            }
       
            // Check whether this is an "old" screen (that returns a ConcreteElement)
            // or a "new" one that returns null.
            if (result != null)
            {
                //The ECS element must serialize in the character encoding
                // of the response
                result.setCodeSet(data.getResponse().getCharacterEncoding());

                result.output(data.getResponse().getWriter());
            }

        }
        catch (Exception e)
        {
View Full Code Here

            if (this.tool == null)
            {
                this.tool = new CustomLocalizationTool();
                this.tool.init(data);
            }
            ConcreteElement result = null;
            String def = this.alt != null && this.alt.trim().length() > 0 ? this.alt : this.key;

            try
            {
                String translation = this.tool.get(key, CustomLocalization.getLocale(data));
View Full Code Here

        try
        {
            pageContext.getOut().flush();

            ConcreteElement result = new ConcreteElement();
            Entry entry = null;

            if (this.psml != null)
            {
                ProfileLocator baseLocator = Profiler.createLocator();
                baseLocator.createFromPath(this.psml);
                Profile baseProfile = Profiler.getProfile(baseLocator);
                if (baseProfile != null)
                {
                    entry = baseProfile.getDocument().getEntry(name);
                    if ( logger.isDebugEnabled() )
                    {
                        logger.debug("JetspeedPortletTag: retrieved [" + entry + "] from psml [" + this.psml);
                    }
                }
            }
            else
            {
                entry  = data.getProfile().getDocument().getEntry(name);
                if ( logger.isDebugEnabled() )
                {
                    logger.debug("JetspeedPortletTag: retrieved [" + entry + "] from current psml");
                }
            }

            if (entry != null)
            {
                result = PortletFactory.getPortlet(entry).getContent(data);
            }

            // Check whether this is an "old" screen (that returns a ConcreteElement)
            // or a "new" one that returns null.
            if ( result != null )
            {
                //The ECS element must serialize in the character encoding
                // of the response
                result.setCodeSet( data.getResponse().getCharacterEncoding() );

                result.output( data.getResponse().getWriter() );
            }

        }
        catch (Exception e)
        {
View Full Code Here

        }

        RunData data = (RunData) context.get("data");
        CapabilityMap map = ((JetspeedRunData) data).getCapability();
        String type = map.getPreferredType().toString();
        ConcreteElement content = new JetspeedClearElement(INVALID_TYPE);
        String stylesheet = (String) stylesheets.get(type);

        if (stylesheet != null)
        {
View Full Code Here

                logger.error("Exception",  pe);
            }
        }
        CapabilityMap map = ((JetspeedRunData)data).getCapability();
        String type = map.getPreferredType().toString();
        ConcreteElement content = new JetspeedClearElement(INVALID_TYPE);
        String stylesheet = (String)stylesheets.get(type);

        if (stylesheet != null) {
            content = getContent( data, map );
            if ( content == null ) {
View Full Code Here

        // Process View
        // call processView method
        logger.info("GenericMVCPortlet - calling processView on processor");

        ConcreteElement result = (ConcreteElement) processor.processView(context);
        logger.info("GenericMVCPortlet - setting this portlet's content");
        clearContent();
        setContent(result); // only needed when caching is true I believe

        // return result
View Full Code Here

        Context context = TurbineVelocity.getContext(rundata);
        context.put( "data", rundata);
        TurbineVelocity.getContext(rundata).put("jetspeed", new org.apache.jetspeed.util.template.JetspeedTool(rundata));

        ConcreteElement result = null;
        String controlName = rundata.getParameters().getString("previewedControlName");
        String portletName = rundata.getParameters().getString("previewedPortletName");
        if ( portletName == null )
        {
            JetspeedLink jsLink = null;

            try
            {
                jsLink = JetspeedLinkFactory.getInstance(rundata);
                rundata.setRedirectURI(
                    jsLink.setUser(
                        rundata.getUser().getUserName(), "default.psml")
                    .addPathInfo("template", "Customize")
                    .addPathInfo("media-type", "html")
                    .toString()
                    );
                JetspeedLinkFactory.putInstance(jsLink);
                jsLink = null;
                return new JetspeedClearElement("");
            } catch (Exception e)
            {
                Log.error(e);
                rundata.setScreenTemplate("Home");
                return new JetspeedClearElement("");
            }
            //return new JetspeedClearElement("You must specify portlet to preview using [previewedPortletName] parameter");
        }
        Portlet portlet = null;

        try
        {
            portlet = PortletFactory.getPortlet(portletName, "PreviewPortlet");
            PortletControl control = controlName == null ? PortalToolkit.getControl((String)null) :
                                     PortalToolkit.getControl(controlName);
            control = null;
            if ( control != null )
            {
                JetspeedRunData jdata = (JetspeedRunData)rundata;
                // Use the profile's skin
                //portlet.getPortletConfig().setSkin(PortalToolkit.getSkin(jdata.getProfile().getDocument().getPortlets().getSkin()));
                control.setPortlet(portlet);
                control.init();
                result = control.getContent(rundata);
            }
            else if ( portlet != null )
            {
                result = portlet.getContent(rundata);
            }

            if ( result != null && !result.toString().equals("") )
            {
                /*String html =  result.toString();
                String currentURL = rundata.getRequest().getRequestURI();
                Log.debug("PreviewPortlet: currentURL = " + currentURL + " reader value = " + html);
                PreviewRewriter rewriter = new PreviewRewriter(currentURL, currentURL , currentURL, portletName);
View Full Code Here

TOP

Related Classes of org.apache.ecs.ConcreteElement

Copyright © 2018 www.massapicom. 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.