Package org.apache.turbine.util

Examples of org.apache.turbine.util.DynamicURI


            //
            // dup key found - display error message - bring back to same screen
            //
            JetspeedLink link = JetspeedLinkFactory.getInstance(rundata);
            DynamicURI duri = link.addPathInfo(SecurityConstants.PARAM_MODE,
                                               "export_all")
                              .addPathInfo(SecurityConstants.PARAM_MSGID,
                                           SecurityConstants.MID_UPDATE_FAILED);
            JetspeedLinkFactory.putInstance(link);
            rundata.setRedirectURI(duri.toString());
        }
        // save values that user just entered so they don't have to re-enter
        if (copyTo != null)
        {
            rundata.getUser().setTemp(COPY_TO, copyTo);
View Full Code Here


            // validate that its not an 'blank' profile -- not allowed
            //
            if (name == null || name.trim().length() == 0)
            {
                JetspeedLink link = JetspeedLinkFactory.getInstance(rundata);
                DynamicURI duri = link.addPathInfo(SecurityConstants.PARAM_MODE,
                                                   "import")
                                  .addPathInfo(SecurityConstants.PARAM_MSGID,
                                               SecurityConstants.MID_INVALID_ENTITY_NAME);
                JetspeedLinkFactory.putInstance(link);
                rundata.setRedirectURI(duri.toString());

                //save user entered values
                if (locator != null)
                {
                    rundata.getUser().setTemp(TEMP_LOCATOR, locator);
                }
                if (categoryName != null)
                {
                    rundata.getUser().setTemp(CATEGORY_NAME, categoryName);
                }
                if (categoryValue != null)
                {
                    rundata.getUser().setTemp(CATEGORY_VALUE, categoryValue);
                }
                if (copyFrom != null)
                {
                    rundata.getUser().setTemp(COPY_FROM, copyFrom);
                }
                return;
            }

            //
            // Retrieve the document to import
            //
            PSMLDocument doc = this.loadDocument(copyFrom);

            //
            // create a new profile
            //
            if (doc != null)
            {
                Portlets portlets = doc.getPortlets();
                //
                // Profiler does not provide update capability - must remove before replacing
                //
                if (PsmlManager.getDocument(locator) != null)
                {
                    Profiler.removeProfile(locator);
                }
                profile = Profiler.createProfile(locator, portlets);
            }
            else
            {
                throw new Exception("Failed to load PSML document from disk");
            }
            rundata.addMessage("Profile for [" + locator.getPath() + "] has been imported from file [" + copyFrom + "]<br>");
            setRefreshPsmlFlag(rundata, TRUE);

            goBackToBrowser(rundata);

        }
        catch (Exception e)
        {
            // log the error msg
            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")
                              .addPathInfo(SecurityConstants.PARAM_MSGID,
                                           SecurityConstants.MID_UPDATE_FAILED);
            JetspeedLinkFactory.putInstance(link);
            rundata.setRedirectURI(duri.toString());
        }
        // save values that user just entered so they don't have to re-enter
        if (locator != null)
        {
            rundata.getUser().setTemp(TEMP_LOCATOR, locator);
View Full Code Here

            //
            // 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());
        }
        // save values that user just entered so they don't have to re-enter
        if (copyFrom != null)
        {
            rundata.getUser().setTemp(COPY_FROM, copyFrom);
View Full Code Here

    private static final JetspeedLogger logger = JetspeedLogFactoryService.getLogger(SendNewUserNotificationEmail.class.getName());   
   
    public void doPerform( RunData data ) throws Exception
    {
        JetspeedUser user = JetspeedSecurity.getUser(data.getParameters().getString("username", ""));       
        DynamicURI url = new DynamicURI(data)
                             .addPathInfo("pane0", "Security" )
                             .addPathInfo("select-panel2", "User")
                             .addPathInfo("entityid", user.getUserName() )
                             .addQueryData("mode","update");
        try
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,
                                              null,
                                              baseLocator.getMediaType(),
                                              baseLocator.getLanguage(),
                                              baseLocator.getCountry());
                result = new StringElement(uri.toString());
                JetspeedLinkFactory.putInstance(link);
            }

            // Output the result
            if (result != null)
View Full Code Here

    public int doStartTag() throws JspException
    {
        RunData data = (RunData)pageContext.getAttribute(JspService.RUNDATA, PageContext.REQUEST_SCOPE);   
       
        TemplateLink link = new TemplateLink( data );
        DynamicURI uri = link.setPage( template );
        if ( action != null ) uri = uri.setAction( action );

        try
        {
            if (uri != null) {
                pageContext.getOut().print(uri.toString());
            }
        }
        catch (Exception e)
        {
            String message = "Error processing TemplateLink-tag, parameter: template='"+ template + "', action='" +action +"'";
View Full Code Here

    */

    public static DynamicURI getPortletEditURI( Portlet portlet,
                                                RunData data) {

        DynamicURI uri = new DynamicURI( data, "Info" );
        uri.addPathInfo( "portlet", portlet.getName() );

        return uri;

    }
View Full Code Here

    Get a URL for viewing this URL full screen. This is the only method that
    will work if the user has disabled cookies.
    */
    public static DynamicURI getPortletMaxURI( RegistryEntry entry, RunData data ) {

        DynamicURI uri = new DynamicURI( data );

        uri.addPathInfo( "portlet", entry.getName() );

        return uri;

    }
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)
            {
                uri = service.forward(data, this.name, this.target);
            }
            else if (this.getName() != null)
            {
                uri = service.forward(data, this.name);
            }
            if (uri != null)
            {
                result = new StringElement(uri.toString());
            }

            // Output the result
            if (result != null)
            {
View Full Code Here

    private DynamicURI forwardInternal(RunData rundata,
                                   String  forwardName,
                                   Map staticParams,
                                   Map dynamicParams)
    {
        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)
            {
                baseQueryParams = forward.getQueryParams();
            }
            setQueryParams(duri, baseQueryParams, staticParams, dynamicParams);

            rundata.setRedirectURI(duri.toString());
            JetspeedLinkFactory.putInstance(link);
        }
        catch (Throwable t)
        {
            logger.error("Exception in Forward",t);
View Full Code Here

TOP

Related Classes of org.apache.turbine.util.DynamicURI

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.