Examples of DynamicURI


Examples of org.apache.turbine.util.DynamicURI

            //
            // tell the user that they can now use jetspeed
            //

            DynamicURI url = new DynamicURI(rundata);

            //build body via template
            StringWriter email_body = new StringWriter();
            SimpleEmail se = new SimpleEmail();
            Context emailContext = TurbineVelocity.getContext();
            emailContext.put( "data", rundata );
            emailContext.put( "user", user );
            emailContext.put( "config",new JetspeedResources());
            emailContext.put( "urltojetspeed",url);
            emailContext.put( "email",se);

            //determine the language to be used for the notification email
            String language = (String)user.getPerm("language",TurbineResources.getString("locale.default.language", "en"));
            String country = (String)user.getPerm("country",TurbineResources.getString("locale.default.country", "US"));
            Locale locale = new Locale(language,country);

            String templateFile = JetspeedResources.getString("newuser.approval.accept.template");
            String templatePath = TemplateLocator.locateEmailTemplate(rundata, templateFile, locale );
            TurbineVelocity.handleRequest(emailContext, templatePath, email_body);

            se.setMsg( email_body.toString() );

            Properties props = System.getProperties();
            String mailServerMachine = JetspeedResources.getString( "mail.server" );
            props.put ( "mail.host", mailServerMachine );
            props.put("mail.smtp.host", mailServerMachine);

            se.send();


        } catch (Exception e)
        {
            // log the error msg
            logger.error("Exception", e);

            //
            // error on update - display error message
            //
            DynamicURI duri = new DynamicURI (rundata);
            duri.addPathInfo(SecurityConstants.PANE_NAME, SecurityConstants.PANEID_USER_UPDATE);
            duri.addPathInfo(SecurityConstants.PARAM_MSGID, SecurityConstants.MID_UPDATE_FAILED);
            if (user != null)
                duri.addPathInfo(SecurityConstants.PARAM_ENTITY_ID, user.getUserName());
            duri.addQueryData(SecurityConstants.PARAM_MODE, SecurityConstants.PARAM_MODE_UPDATE);
            rundata.setRedirectURI(duri.toString());
            // save values that user just entered so they don't have to re-enter
            if (user != null)
                rundata.getUser().setTemp(TEMP_USER, user);
        }
     }
View Full Code Here

Examples of org.apache.turbine.util.DynamicURI

            //
            // tell the user that they can now use jetspeed
            //

            DynamicURI url = new DynamicURI(rundata);

            //build body via template
            StringWriter email_body = new StringWriter();
            SimpleEmail se = new SimpleEmail();
            Context emailContext = TurbineVelocity.getContext();
            emailContext.put( "data", rundata );
            emailContext.put( "user", user );
            emailContext.put( "config",new JetspeedResources());
            emailContext.put( "urltojetspeed",url);
            emailContext.put( "email",se);

            //determine the language to be used for the notification email
            String language = (String)user.getPerm("language",TurbineResources.getString("locale.default.language", "en"));
            String country = (String)user.getPerm("country",TurbineResources.getString("locale.default.country", "US"));
            Locale locale = new Locale(language,country);

            String templateFile = JetspeedResources.getString("newuser.approval.reject.template");
            String templatePath = TemplateLocator.locateEmailTemplate(rundata, templateFile, locale );
            TurbineVelocity.handleRequest(emailContext, templatePath, email_body);

            se.setMsg( email_body.toString() );

            Properties props = System.getProperties();
            String mailServerMachine = JetspeedResources.getString( "mail.server" );
            props.put ( "mail.host", mailServerMachine );
            props.put("mail.smtp.host", mailServerMachine);

            se.send();

        } catch (Exception e)
        {
            // log the error msg
              logger.error("Exception", e);

            //
            // error on update - display error message
            //
            DynamicURI duri = new DynamicURI (rundata);
            duri.addPathInfo(SecurityConstants.PANE_NAME, SecurityConstants.PANEID_USER_UPDATE);
            duri.addPathInfo(SecurityConstants.PARAM_MSGID, SecurityConstants.MID_UPDATE_FAILED);
            if (user != null)
                duri.addPathInfo(SecurityConstants.PARAM_ENTITY_ID, user.getUserName());
            duri.addQueryData(SecurityConstants.PARAM_MODE, SecurityConstants.PARAM_MODE_UPDATE);
            rundata.setRedirectURI(duri.toString());
            // save values that user just entered so they don't have to re-enter
            if (user != null)
                rundata.getUser().setTemp(TEMP_USER, user);
        }
     }
View Full Code Here

Examples of org.apache.turbine.util.DynamicURI

                            rundata.getParameters().getString(SecurityConstants.PARAM_ENTITY_ID));

            String name = rundata.getParameters().getString("username");
            if (name == null || name.trim().length() == 0)
            {
                DynamicURI duri = new DynamicURI (rundata);
                duri.addPathInfo(SecurityConstants.PANE_NAME, SecurityConstants.PANEID_USER_UPDATE);
                duri.addPathInfo(SecurityConstants.PARAM_MSGID, SecurityConstants.MID_INVALID_ENTITY_NAME);
                if (user != null)
                    duri.addPathInfo(SecurityConstants.PARAM_ENTITY_ID, user.getUserName());
                duri.addQueryData(SecurityConstants.PARAM_MODE, SecurityConstants.PARAM_MODE_UPDATE);
                rundata.setRedirectURI(duri.toString());
                // save values that user just entered so they don't have to re-enter
                if (user != null)
                   rundata.getUser().setTemp(TEMP_USER, user);
                return;
            }

            //
            // pull the values off the form and into the user object
            //
            boolean oldDisabled = user.getDisabled();
            rundata.getParameters().setProperties(user);
            user.setLastAccessDate();

            JetspeedSecurity.forcePassword(user,rundata.getParameters().getString("password"));

            String strDisabled = rundata.getParameters().getString("disabled");
            boolean disabled = (strDisabled != null);
            user.setDisabled(disabled);

            if  (!disabled && oldDisabled && JetspeedSecurity.isDisableAccountCheckEnabled())
            {
                JetspeedSecurity.resetDisableAccountCheck(name);
            }

            //
            // update the user in the database
            //
            JetspeedSecurity.saveUser(user);

            JetspeedUser currentUser = (JetspeedUser)rundata.getUser();
            if (currentUser.getUserName().equals(user.getUserName()))
            {
                // same user as admin -- need to update in memory
                currentUser.setPassword(user.getPassword()); // Contains Encrypted password
                currentUser.setFirstName(user.getFirstName());
                currentUser.setLastName(user.getLastName());
                currentUser.setEmail(user.getEmail());
            }

        }
        catch (Exception e)
        {
           // log the error msg
            logger.error("Exception", e);

            //
            // error on update - display error message
            //
            DynamicURI duri = new DynamicURI (rundata);
            duri.addPathInfo(SecurityConstants.PANE_NAME, SecurityConstants.PANEID_USER_UPDATE);
            duri.addPathInfo(SecurityConstants.PARAM_MSGID, SecurityConstants.MID_UPDATE_FAILED);
            if (user != null)
                duri.addPathInfo(SecurityConstants.PARAM_ENTITY_ID, user.getUserName());
            duri.addQueryData(SecurityConstants.PARAM_MODE, SecurityConstants.PARAM_MODE_UPDATE);
            rundata.setRedirectURI(duri.toString());
            // save values that user just entered so they don't have to re-enter
            if (user != null)
               rundata.getUser().setTemp(TEMP_USER, user);
        }
View Full Code Here

Examples of org.apache.turbine.util.DynamicURI

                    clearUserData(rundata);
                }
                else
                {
                   
                    DynamicURI duri = redirect(rundata, SecurityConstants.PARAM_MODE_UPDATE, SecurityConstants.MID_MISSING_PARAMETER);
                    rundata.setRedirectURI(duri.toString());
                    resetForm(rundata);
                }
            }
            else
            {
                DynamicURI duri = redirect(rundata, SecurityConstants.PARAM_MODE_UPDATE, SecurityConstants.MID_INVALID_ENTITY_NAME);
                rundata.setRedirectURI(duri.toString());
                resetForm(rundata);
               
                logger.error("Failed to find registry entry while trying to add accesses");
            }
        }
        catch (Exception e)
        {
            DynamicURI duri = redirect(rundata, SecurityConstants.PARAM_MODE_UPDATE, SecurityConstants.MID_UPDATE_FAILED);
            rundata.setRedirectURI(duri.toString());
            resetForm(rundata);
           
            logger.error("Exception", e);
        }
    }
View Full Code Here

Examples of org.apache.turbine.util.DynamicURI

   {
       int queryStart = rundata.getParameters().getInt("previous", 0);
       String mtype = rundata.getParameters().getString("mtype", null);
       maintainUserSelections(rundata);
       JetspeedLink link = JetspeedLinkFactory.getInstance(rundata);
       DynamicURI duri = null;
       if (mtype == null)
       {
           duri = link.setTemplate("Customize").addQueryData("start", String.valueOf(queryStart));
       }
       else
       {
           duri = link.setTemplate("Customize").
               addQueryData("start", String.valueOf(queryStart)).
               addQueryData("mtype", mtype);
       }
       JetspeedLinkFactory.putInstance(link);
       rundata.setRedirectURI(duri.toString());
       return;
   }
View Full Code Here

Examples of org.apache.turbine.util.DynamicURI

   {
       int queryStart = rundata.getParameters().getInt("next", 0);
       String mtype = rundata.getParameters().getString("mtype", null);
       maintainUserSelections(rundata);
       JetspeedLink link = JetspeedLinkFactory.getInstance(rundata);
       DynamicURI duri = null;
       if (mtype == null)
       {
           duri = link.setTemplate("Customize").addQueryData("start", String.valueOf(queryStart));
       }
       else
       {
           duri = link.setTemplate("Customize").
               addQueryData("start", String.valueOf(queryStart)).
               addQueryData("mtype", mtype);
       }
       JetspeedLinkFactory.putInstance(link);
       rundata.setRedirectURI(duri.toString());
       return;
   }
View Full Code Here

Examples of org.apache.turbine.util.DynamicURI

        PortletSessionState.setAttribute(rundata, "filter_category", filterCat);
        maintainUserSelections(rundata);
       
        String mtype = rundata.getParameters().getString("mtype", null);
        JetspeedLink link = JetspeedLinkFactory.getInstance(rundata);
        DynamicURI duri = null;
        if (mtype == null)
        {
            duri = link.setTemplate("Customize").addQueryData("start", "0");
        }
        else
        {
            duri = link.setTemplate("Customize").addQueryData("start", "0").addQueryData("mtype", mtype);
        }
        JetspeedLinkFactory.putInstance(link);
        rundata.setRedirectURI(duri.toString());
        return;
       
       
    }
View Full Code Here

Examples of org.apache.turbine.util.DynamicURI

        // bring logged on user to homepage via HTTP redirect
       
        try
        {
            JetspeedLink jsLink = JetspeedLinkFactory.getInstance(data);
            DynamicURI duri = jsLink.getLink(JetspeedLink.CURRENT,null,null,JetspeedLink.CURRENT,null);
            String mtype = data.getParameters().getString("mtype");
            if (mtype != null)
            {
                jsLink.setMediaType(mtype);
                duri = jsLink.addQueryData("mtype", mtype);
                duri = duri.addPathInfo("media-type", mtype);
                String language = data.getParameters().getString("language");
                if(language != null)
                {
                  duri = duri.addQueryData("language",language);
                  String country = data.getParameters().getString("country");
                  if(country != null)
                  {
                    duri = duri.addQueryData("country", country);
                  }
                }
            }
           
            data.setRedirectURI(duri.toString());
            JetspeedLinkFactory.putInstance(jsLink);
          jsLink = null;
        }
        catch (Exception e)
        {
View Full Code Here

Examples of org.apache.turbine.util.DynamicURI

    * @return A new dynamic URI representing all profile parameters from the locator.
    */
    public DynamicURI makeDynamicURI( RunData data, ProfileLocator locator )
        throws ProfileException
    {
        DynamicURI uri = new DynamicURI( data );

       // check mediatype to add to the uri
        String mtype = locator.getMediaType();
        if (null != mtype)
        {
            uri.addPathInfo(Profiler.PARAM_MEDIA_TYPE, mtype);
        }

       // check language to add to the uri
        String language = locator.getLanguage();
        if (null != language)
        {
            uri.addPathInfo(Profiler.PARAM_LANGUAGE, language);
        }

       // check language to add to the uri
        String country = locator.getCountry();
        if (null != country)
        {
            uri.addPathInfo(Profiler.PARAM_COUNTRY, country);
        }

        // check User, Group or Role to add to the uri
        JetspeedUser user = locator.getUser();
        if (null != user)
        {
            if (user.getUserName() != null)
                uri.addPathInfo(Profiler.PARAM_USER, user.getUserName());
        }
        else
        {
            Group group = locator.getGroup();
            if (null != group)
            {
                uri.addPathInfo(Profiler.PARAM_GROUP, group.getName());
            }
            else
            {
                Role role = locator.getRole();
                if (null != role)
                {
                    uri.addPathInfo(Profiler.PARAM_ROLE, role.getName());
                }
            }
        }

        // check Page to add to the uri
        String page = locator.getName();
        if (null != page)
        {
            uri.addPathInfo(Profiler.PARAM_PAGE, page);
        }

        return uri;
    }
View Full Code Here

Examples of org.apache.turbine.util.DynamicURI

                    clearUserData(rundata);
                }
                else
                {
                    DynamicURI duri = redirect(rundata, SecurityConstants.PARAM_MODE_UPDATE, SecurityConstants.MID_MISSING_PARAMETER);
                    rundata.setRedirectURI(duri.toString());

                    resetForm(rundata);
                }
            }
            else
            {
                DynamicURI duri = redirect(rundata, SecurityConstants.PARAM_MODE_UPDATE, SecurityConstants.MID_INVALID_ENTITY_NAME);
                rundata.setRedirectURI(duri.toString());
                resetForm(rundata);
               
                logger.error("Failed to find registry entry while trying to add category");
            }
        }
        catch (Exception e)
        {
            DynamicURI duri = redirect(rundata, SecurityConstants.PARAM_MODE_UPDATE, SecurityConstants.MID_UPDATE_FAILED);
            rundata.setRedirectURI(duri.toString());
            resetForm(rundata);
           
            logger.error("Exception", e);
        }
    }
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.