Package net.sf.jportlet.portlet

Examples of net.sf.jportlet.portlet.PortletContext


public class ValidationHelper
{
    public static void addError( String      msg,
                           ActionEvent event )
    {
        PortletContext ctx = event.getPortlet(  ).getPortletConfig(  ).getPortletContext(  );
        event.addError( ctx.getText( msg, event.getPortletRequest(  ).getLocale(  ) ) );
    }
View Full Code Here


            doForgotPassword( event, request );
            return;
        }

        /* Send */
        PortletContext ctx = event.getPortlet(  ).getPortletConfig(  ).getPortletContext(  );
        UserService    usr = ( UserService ) ctx.getService( UserService.NAME );
        try
        {
            /* Get the user */
            UserImpl u = ( UserImpl ) usr.getUserByEmail( email );

            /* Generate the email message */
            String subject = "Password Requested";
            StringBuffer body = new StringBuffer();
            body.append( u.getFirstname(  ) + " " + u.getLastname(  ) + "\n" );
            body.append( "Here is your requested password\n" );
            body.append( " Login: " + u.getId(  ) + "\n" );
            body.append( " Password: " + u.getPassword(  ) + "\n\n" );

            /* Send the message */
            MailService mailer = ( MailService ) ctx.getService( MailService.NAME );
            mailer.send( null, new Address[] { new InternetAddress( u.getEmail(  ) ) }, subject, body.toString(), MailService.MIME_TEXT );
        }
        catch ( UserNotFoundException u )
        {
            ctx.getLog(  ).warn( email + " not found", u );
        }
        catch ( Exception e )
        {
            throw new PortletException( e );
        }
View Full Code Here

    private void doLogin( ActionEvent    event,
                          PortletRequest request )
        throws PortletException
    {
        PortletContext context = event.getPortlet(  ).getPortletConfig(  ).getPortletContext(  );
        LoginService   service = ( LoginService ) context.getService( LoginService.NAME );
        if ( !service.login( request ) )
        {
            ValidationHelper.addError( "error_login_failed", event );
            doSignin( event, request );
        }
View Full Code Here

    private void doLogout( ActionEvent    event,
                           PortletRequest request )
        throws PortletException
    {
        PortletContext context = event.getPortlet(  ).getPortletConfig(  ).getPortletContext(  );
        LoginService   service = ( LoginService ) context.getService( LoginService.NAME );
        service.logout( request );

        event.setReturnCode( "logout" );
        notifyDataChanged( event );
    }
View Full Code Here

        try
        {
            if ( validate( userId, password, email, firstname, lastname, locale, event ) )
            {
                PortletContext ctx = event.getPortlet(  ).getPortletConfig(  ).getPortletContext(  );
                UserService    srv = ( UserService ) ctx.getService( UserService.NAME );
                if ( register )
                {
                    srv.addUser( request );
                    event.setReturnCode( "register" );
                }
View Full Code Here

TOP

Related Classes of net.sf.jportlet.portlet.PortletContext

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.