Package org.apache.jetspeed.util.template

Examples of org.apache.jetspeed.util.template.JetspeedLink


            logger.error("Exception", e);

            //
            // dup key found - display error message - bring back to same screen
            //
            JetspeedLink link = JetspeedLinkFactory.getInstance(rundata);
            DynamicURI duri = link.addPathInfo(SecurityConstants.PARAM_MODE,
                                               "import_all")
                              .addPathInfo(SecurityConstants.PARAM_MSGID,
                                           SecurityConstants.MID_UPDATE_FAILED);
            JetspeedLinkFactory.putInstance(link);
            rundata.setRedirectURI(duri.toString());
View Full Code Here


     *
     * @param rundata
     */
    private void goBackToBrowser(RunData rundata) throws Exception
    {
        JetspeedLink link = JetspeedLinkFactory.getInstance(rundata);
        rundata.setRedirectURI(link.toString());
        JetspeedLinkFactory.putInstance(link);
    }
View Full Code Here

                {
                    elementType = JetspeedLink.PORTLET_ID;
                    elementValue = this.jspeid;
                }
                // Build the link
                JetspeedLink link = JetspeedLinkFactory.getInstance(data);
                DynamicURI uri = link.getLink(rootType,
                                              rootValue,
                                              baseLocator.getName(),
                                              elementType,
                                              elementValue,
                                              this.action == null ? "controls.Maximize" : this.action,
View Full Code Here

            PortalResource portalResource = new PortalResource(p);

            // Secure the tabs
            try
            {
                JetspeedLink jsLink = JetspeedLinkFactory.getInstance(rundata);
                portalResource.setOwner(jsLink.getUserName());
                JetspeedLinkFactory.putInstance(jsLink);
            }
            catch (Exception e)
            {
                logger.warn(e.toString(), e);
View Full Code Here

        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);
View Full Code Here

    public boolean allowCustomize(RunData rundata)
    {
        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);
View Full Code Here

     * the actions available for this portlet
     */
    protected List buildActionList( RunData rundata, Portlet portlet )
    {
        List actions = new Vector();
        JetspeedLink jsLink = null;
        JetspeedRunData jdata = (JetspeedRunData)rundata;

        // disable actions option
        if (JetspeedSecurity.areActionsDisabledForAllUsers())
        {
            return actions;
        }
        JetspeedUser user = jdata.getJetspeedUser();
        if (JetspeedSecurity.areActionsDisabledForAnon() && false == user.hasLoggedIn())
        {
            return actions;
        }


        // list the available actiosn for this portlet
        if (portlet instanceof PortletState)
        {           
            // the portlet is state aware
            PortletState state = (PortletState)portlet;
            boolean customized = (jdata.getMode()==jdata.CUSTOMIZE);
            boolean maximized = customized||(jdata.getMode()==jdata.MAXIMIZE);
            boolean infoAdded = false;
                   
            if ( state.allowCustomize( rundata ) )
            {
                if (! customized )
                {
                    actions.add( new PortletAction("customize", "Customize") );
                }
            }
            else
            {
                if ( state.allowInfo( rundata ) )
                {
                    actions.add( new PortletAction("info", "Information") );
                    infoAdded = true;
                }
            }

            if ( (!customized) &&  state.allowPrintFriendly( rundata ) )
            {
                actions.add( new PortletAction("print", "Print Friendly Format") );
            }

            if ( (!customized) &&  state.allowInfo( rundata ) && (!infoAdded) )
            {
                actions.add( new PortletAction("info", "Information") );
            }
                      
            if ( (!customized) && (!maximized) && state.allowClose( rundata ) )
            {
                actions.add( new PortletAction("close", "Close") );
            }
           
            if ( state.isMinimized( rundata ) || maximized )
            {
                actions.add( new PortletAction("restore", "Restore") );
            }
            else
            {
                if ( state.allowMinimize( rundata ) )
                {
                    actions.add( new PortletAction("minimize", "Minimize") );
                }

                if ( state.allowMaximize( rundata ) )
                {
                    actions.add( new PortletAction("maximize", "Maximize") );
                }
            }
        }
        else
        {
            // the portlet only knows about edit and maximize
            if ( portlet.getAllowEdit( rundata ) )
            {
                actions.add( new PortletAction("info", "Information") );
            }
       
            if ( portlet.getAllowMaximize( rundata ) )
            {
                actions.add( new PortletAction("maximize", "Maximize") );
            }
        }
       
        // Now that we know which actions should be displayed,
        // build the links and put it in the context
        Iterator i = actions.iterator();
               
        while( i.hasNext() )
        {
            PortletAction action = (PortletAction)i.next();

            try
            {
                jsLink = JetspeedLinkFactory.getInstance(rundata);
            }
            catch( Exception e)
            {
               logger.error( "Exception in buildActionList", e );
            }
//            action.setLink( jsLink.setPortletById(portlet.getID())
//                                 .addQueryData("action", getAction( action.getName()))
//                                 .toString());
            action.setLink( jsLink.setAction( getAction( action.getName()), portlet).toString());
            JetspeedLinkFactory.putInstance(jsLink);
            jsLink=null;
        }
       
        return actions;
View Full Code Here

        {
          // Authenticate the user and get the object.
          usr = JetspeedSecurity.login( username, password );

          // bring logged on user to homepage via redirect
          JetspeedLink jslink = JetspeedLinkFactory.getInstance(data);
          data.setRedirectURI(jslink.getHomePage().toString());
          JetspeedLinkFactory.putInstance(jslink);
        }
        catch ( Exception e )
        {
            logger.error("Exception", e);
View Full Code Here

        DynamicURI duri = null;
        Forward forward = null;

        try
        {
            JetspeedLink link = JetspeedLinkFactory.getInstance(rundata);
            int rootType = JetspeedLink.DEFAULT;
            int elementType = JetspeedLink.DEFAULT;
            String rootValue = null;
            String pageName = null;
            String elementValue = null;
            String actionName = null;
            String templateName = null;
            String mediaType = null;
            String language = null;
            String country = null;


            forward = (Forward)this.forwards.get(forwardName);
            if (null != forward)
            {
                Pane pane = forward.getPane();
                if (null != pane)
                {
                    elementValue = pane.getId();
                    elementType = JetspeedLink.PANE_ID;
                    if (elementValue == null)
                    {
                        elementValue = pane.getName();
                        elementType = JetspeedLink.PANE_NAME;
                    }                   
                }
                else // can't have both portlet and pane
                {
                    Portlet portlet = forward.getPortlet();
                    if (null != portlet)
                    {
                        elementValue = portlet.getId();
                        elementType = JetspeedLink.PORTLET_ID;
                        if (elementValue == null)
                        {
                            elementValue = portlet.getName();
                            elementType = JetspeedLink.PORTLET_NAME;
                        }                   
                        actionName = portlet.getAction();
                    }
                }

                Page page = forward.getPage();
                if (null != page)
                {
                    pageName = page.getName();

                    String user = page.getUser();
                    if (user != null)
                    {
                        rootType = JetspeedLink.USER;
                        rootValue = user;
                    }
                    else
                    {
                        String role = page.getRole();
                        if (role != null)
                        {
                            rootType = JetspeedLink.ROLE;
                            rootValue = role;
                        }
                        else
                        {
                            String group = page.getGroup();
                            if (group != null)
                            {
                                rootType = JetspeedLink.GROUP;
                                rootValue = group;
                            }
                            else
                            {
                                rootType = JetspeedLink.CURRENT;
                            }
                        }
                    }
                }

                duri = link.getLink(rootType,
                             rootValue,
                             pageName,
                             elementType,
                             elementValue,
                             actionName, 
                             templateName, // not yet implemented
                             mediaType,    // not yet implemented
                             language,     // not yet implemented
                             country);     // not yet implemented

            }
            else
            {
                // forward not found, log it and return to home page
                // TODO: perhaps this could be configurable to go to a default error page
                logger.error("Forward not found, going to Home Page:" + forwardName);
                duri = link.getHomePage();
   
            }
   
            if (null == duri)
            {
                duri = link.getPage();
            }

            Map baseQueryParams = null;
            if (null != forward)
            {
View Full Code Here

        JetspeedSecurity.logout();

        data.setMessage(JetspeedResources.getString(
            TurbineConstants.LOGOUT_MESSAGE));

        JetspeedLink jsLink = null;

        data.setScreen(JetspeedResources.getString(
            TurbineConstants.SCREEN_HOMEPAGE));

        try
        {
            jsLink = JetspeedLinkFactory.getInstance(data);
        } catch (Exception e)
        {
            logger.error("Error getting jsLink", e);
        }
        data.setRedirectURI(jsLink.getHomePage().toString());
        JetspeedLinkFactory.putInstance(jsLink);
        jsLink = null;
    }
View Full Code Here

TOP

Related Classes of org.apache.jetspeed.util.template.JetspeedLink

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.