Examples of JetspeedRunData


Examples of org.apache.jetspeed.services.rundata.JetspeedRunData

        {
            rundata.setScreenTemplate("Ecs");
            return;
        }

        JetspeedRunData jdata = (JetspeedRunData)rundata;
        jdata.setJs_peid(peid);
        Entry entry = jdata.getProfile().getDocument().getEntryById(peid);
        if (entry != null)
        {
            if (null != entry.getParameter(J2_ENTITY))
            {
                    return; // JSR 168 portlet, let it handle its own Help Mode
View Full Code Here

Examples of org.apache.jetspeed.services.rundata.JetspeedRunData

        if ( peid == null )
        {
            return;
        }
       
        JetspeedRunData jdata = (JetspeedRunData)rundata;

        // Remove the Portlet using the PEID
        jdata.getProfile().getDocument().removeEntryById(peid);
    }
View Full Code Here

Examples of org.apache.jetspeed.services.rundata.JetspeedRunData

            }
        }

        // now, define Jetspeed specific properties, using the customized
        // RunData properties
        JetspeedRunData jdata = null;

        try
        {
            jdata = (JetspeedRunData) data;
        }
        catch (ClassCastException e)
        {
            logger.error("The RunData object does not implement the expected interface, "
                      + "please verify the RunData factory settings");
            return;
        }
        String language = (String) data.getRequest().getParameter("js_language");

        if (null != language)
        {
            user.setPerm("language", language);
        }

        // Get the locale store it in the user object
        CustomLocalizationService locService =
            (CustomLocalizationService) ServiceUtil.getServiceByName(LocalizationService.SERVICE_NAME);
        Locale locale = locService.getLocale(data);
        if (locale == null)
        {
            locale = new Locale(TurbineResources.getString("locale.default.language", "en"),
                                TurbineResources.getString("locale.default.country", "US"));
        }

        data.getUser().setTemp("locale", locale);

        // if a portlet is referenced in the parameters request, store it
        // in the RunData object
        String paramPortlet = jdata.getParameters().getString("js_peid");
        if (paramPortlet != null && paramPortlet.length() > 0)
        {
            jdata.setJs_peid(paramPortlet);
        }

    }
View Full Code Here

Examples of org.apache.jetspeed.services.rundata.JetspeedRunData

        {
            return;
        }
       
        // Get the Portlet using the PSML document and the PEID
        JetspeedRunData jdata = (JetspeedRunData)rundata;

        // Get the Portlet using the PSML document and the PEID
        Entry entry = jdata.getProfile().getDocument().getEntryById(peid);
        if ( entry == null )
        {
            logger.warn("Failed to get PEID (" + peid + ") entry for User ("
              + rundata.getUser().getName() + ")");
            return;
        }

        //record that this portlet is now maximized
        jdata.getUser().setTemp("js_peid",peid);

    }
View Full Code Here

Examples of org.apache.jetspeed.services.rundata.JetspeedRunData

            ActionLoader.getInstance().getInstance(
                JetspeedResources.getString(TurbineConstants.ACTION_LOGIN)
                ).doPerform(rundata);

            // Update the profile in rundata - not sure why this is not happening automatically?
            JetspeedRunData jdata = (JetspeedRunData) rundata;
            jdata.setProfile(Profiler.getProfile(jdata));

        }
        catch (Exception e)
        {
            logger.error("Exception", e);
View Full Code Here

Examples of org.apache.jetspeed.services.rundata.JetspeedRunData

        {
            return;
        }
       
        // Get the Portlet using the PSML document and the PEID
        JetspeedRunData jdata = (JetspeedRunData)rundata;
        Entry entry = jdata.getProfile().getDocument().getEntryById(peid);
        if ( entry == null )
        {
            logger.warn("Failed to get PEID (" + peid + ") entry for User ("
              + rundata.getUser().getName() + ")");
            return;
        }
        Portlet portlet = PortletFactory.getPortlet(entry);
       
        // Now unset the portlet to minimized
        if (( portlet != null )&&( portlet instanceof PortletState ))
        {
            ((PortletState)portlet).setMinimized( false, rundata );
        }

        // make sure we use the default template
        while (jdata.getCustomized()!=null)
        {
            jdata.setCustomized(null);
        }

        //remove the maximized portlet name - nothing is maximized now
        jdata.getUser().removeTemp("js_peid");

        jdata.setScreenTemplate("Home");
    }
View Full Code Here

Examples of org.apache.jetspeed.services.rundata.JetspeedRunData

    public void doPerform( RunData data ) throws Exception
    {
        JetspeedUser user = (JetspeedUser)data.getUser();

        getACL(data);
        JetspeedRunData jdata = null;
       
        try
        {
            jdata = (JetspeedRunData)data;
        }
        catch (ClassCastException e)
        {
            logger.error("The RunData object does not implement the expected interface, "
                       + "please verify the RunData factory settings", e);
            return;
        }

        Profile newProfile = null;
        Profile currentProfile = null;

        try
        {
            // get the profile and store it in the RunData
            newProfile = Profiler.getProfile(jdata);
            currentProfile = jdata.getProfile();
        }
        catch (Throwable other)
        {
            data.setScreenTemplate(JetspeedResources.getString(TurbineConstants.TEMPLATE_ERROR));
            String message = other.getMessage() != null ? other.getMessage() : other.toString();
            data.setMessage(message);
            data.setStackTrace(org.apache.turbine.util.StringUtils.stackTrace(other), other);

            if (currentProfile == null)
            {
                currentProfile = Profiler.createProfile();
            }
            if (newProfile == null)
            {
                newProfile = Profiler.createProfile();
            }
            if (data.getUser() == null)
            {
                JetspeedUser juser = new FakeJetspeedUser(JetspeedSecurity.getAnonymousUserName(), false);
                data.setUser(juser);
            }
        }


        if ((currentProfile == null)
         || (!currentProfile.equals(newProfile)))
        {
            // the profile changed due to the request parameters,
            // change it in the RunData
            jdata.setProfile(newProfile);
        }
    }
View Full Code Here

Examples of org.apache.jetspeed.services.rundata.JetspeedRunData

        if ( peid == null )
        {
            return;
        }
       
        JetspeedRunData jdata = (JetspeedRunData)rundata;

        // Get the Portlet using the PSML document and the PEID
        Entry entry = jdata.getProfile().getDocument().getEntryById(peid);
        if ( entry == null )
        {
            if (logger.isWarnEnabled())
            {
                logger.warn("Failed to get PEID (" + peid + ") entry for User ("
View Full Code Here

Examples of org.apache.jetspeed.services.rundata.JetspeedRunData

    /**
     * @param rundata The RunData object for the current request
     */
    public void doPerform( RunData rundata ) throws Exception
    {
        JetspeedRunData jdata = (JetspeedRunData)rundata;

        if (jdata.getUser() == null)
        {
            return;
        }
        if(jdata.getProfile() == null)
        {
            return;
        }
       
        // read some parameters
        String editMediaType = jdata.getParameters().getString ("mtype");
        String resetStack = jdata.getParameters().getString ("reset");
        String peid = jdata.getParameters().getString("js_peid");

        Entry entry = jdata.getProfile().getDocument().getEntryById(peid);
        if (entry != null)
        {
            if (null != entry.getParameter(J2_ENTITY))
            {
                    return; // JSR 168 portlet, let it handle its own Help Mode
            }
        }
       
        // get the customization state for this page
        SessionState customizationState = jdata.getPageSessionState();

        // this will be the profile we are editing
        Profile profile = null;

        // the "reset" parameter's presence signals the start of customization
        if (    (resetStack != null)
            &&  ((resetStack.equalsIgnoreCase("on")) || (resetStack.equalsIgnoreCase("1"))))
        {
            // clear out any prior customization state
            jdata.cleanupFromCustomization();
        }

        // if we have not yet setup for customization, do so now
        if (jdata.getCustomizedProfile() == null)
        {
            ProfileLocator locator = (ProfileLocator)jdata.getProfile().clone();

            if (editMediaType != null)
            {
                locator.setMediaType(editMediaType);
            }

            // get a profile to edit
            profile = (Profile) Profiler.getProfile(locator).clone();
            jdata.setCustomizedProfile(profile);
        }

        // we are continuing an on-going customization
        else
        {
            // get the profile we are working on
            profile = jdata.getCustomizedProfile();
        }

        // Get js_peid parmameter.
        // If it does not exist, we will customize the root of the profile
        if ( peid == null )
        {
            // use the id of the root set of the profile
            peid = profile.getRootSet().getID();
            jdata.setJs_peid(peid);
        }

        // find the portlet within the profile with this peid %%% isn't there a better way to do this? -ggolden
        Portlet found = null;
        Stack sets = new Stack();
        sets.push(profile.getRootSet());

        while ((found==null) && (sets.size() > 0))
        {
            PortletSet set = (PortletSet)sets.pop();

            if (set.getID().equals(peid))
            {
                found = set;
            }
            else
            {
                Enumeration en = set.getPortlets();
                while((found==null) && en.hasMoreElements())
                {
                    Portlet p = (Portlet)en.nextElement();

                    // unstack the controls to find the real PortletSets
                    Portlet real = p;
                    while (real instanceof PortletControl)
                    {
                        real = ((PortletControl)p).getPortlet();
                    }

                    if (real instanceof PortletSet)
                    {
                        if (real.getID().equals(peid))
                        {
                            found=real;
                        }
                        else
                        {
                            // we'll explore this set afterwards
                            sets.push(real);
                        }
                    }
                    else if (p.getID().equals(peid))
                    {
                        found = p;
                    }
                }
            }
        }

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

            if(!JetspeedSecurity.checkPermission((JetspeedUser) jdata.getUser(),
                                                 portalResource,
                                                 JetspeedSecurity.PERMISSION_CUSTOMIZE))
            {
                logger.warn("User " + jdata.getUser().getUserName() + " has no customize permission for portlet with id " + peid);
                jdata.setMessage("Sorry, you have no customize permission for this portlet");
                return;
            }
            jdata.setCustomized(found);
            jdata.setScreenTemplate("Customize");
        }

    }
View Full Code Here

Examples of org.apache.jetspeed.services.rundata.JetspeedRunData

        /*
         * This was copied straight from NTLM.  Could refactor this...
         */
        // now, define Jetspeed specific properties, using the customized
        // RunData properties
        JetspeedRunData jdata = null;

        try
        {
            jdata = (JetspeedRunData) data;
        }
        catch (ClassCastException e)
        {
            logger.error("The RunData object does not implement the expected interface, "
                      + "please verify the RunData factory settings");
            return;
        }
        String language = (String) data.getRequest().getParameter("js_language");

        if (null != language)
        {
            user.setPerm("language", language);
        }

        // Get the locale store it in the user object
        CustomLocalizationService locService =
            (CustomLocalizationService) ServiceUtil.getServiceByName(LocalizationService.SERVICE_NAME);
        Locale locale = locService.getLocale(data);
        if (locale == null)
        {
            locale = new Locale(TurbineResources.getString("locale.default.language", "en"),
                                TurbineResources.getString("locale.default.country", "US"));
        }

        data.getUser().setTemp("locale", locale);

        // if a portlet is referenced in the parameters request, store it
        // in the RunData object
        String paramPortlet = jdata.getParameters().getString("js_peid");
        if (paramPortlet != null && paramPortlet.length() > 0)
        {
            jdata.setJs_peid(paramPortlet);
        }
    }
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.