Package business

Examples of business.User


    @Override
    protected void doPost( HttpServletRequest request, HttpServletResponse response ) throws ServletException, IOException {
        bzb = new BooksZenBooks( "en", dbConfigResource ); // @TODO language should be a request param
        String forwardUrl;
        RequestDispatcher dispatcher;
        User user = bzb.getAuthenticatedUser( request );
        String displayName;

        /* Load necessary lexicons */
        bzb.getLexicon().load( "global" );
        bzb.getLexicon().load( "home" );
        bzb.getLexicon().load( "subject" );

        displayName = user != null ? user.getFirstName() : bzb.getLexicon().get( "guest" );

        bzb.getLexicon().set( "welcome", String.format( bzb.getLexicon().get( "welcome" ), displayName ) );

        forwardUrl = jspPath + "home.jsp";

View Full Code Here


    protected void doPost( HttpServletRequest request, HttpServletResponse response ) throws ServletException, IOException {
        bzb = new BooksZenBooks( "en", dbConfigResource ); // @TODO language should be a request param
        String forwardUrl;
        String pageTitle;
        RequestDispatcher dispatcher;
        User user;
        int userId = RequestHelper.getInt( "userId", request );

        /* Load necessary lexicons */
        bzb.getLexicon().load( "global" );
        bzb.getLexicon().load( "subject" );

        if( bzb.getAuthenticatedUser( request ) == null ) {
            bzb.getLexicon().load( "error" );

            forwardUrl = jspPath + "401.jsp";
            pageTitle = bzb.getLexicon().get( "unauthorized" );
        }
        else {
            bzb.getLexicon().load( "profile" );
            bzb.getLexicon().load( "book" );
            bzb.getLexicon().load( "search" );

            user = getUser( userId );
            forwardUrl = jspPath + "displayUser.jsp";

            pageTitle = bzb.getLexicon().get( "viewingProfile", new String[][]{ { "user", user.getEmail() } } );
           
            request.setAttribute( "user", user );
            request.setAttribute( "stats", getUserStats( userId ) );
            request.setAttribute( "listings", getUserListings( userId ) );
        }
View Full Code Here

        doPost(request, response);
    }

    private User getUser( int userId ) {
        ResultSet result;
        User user = null;
        String where = "userId = " + userId;

        /* Query for user data */
        result = bzb.getDriver().select( "user", null, where );

        try {
            /* Make sure there's a result */
            if( result.next() ) {
                user = new User();

                user.init( bzb.getDriver() );
                user.populate( result );
            }
        } catch( SQLException e ) {

        }

View Full Code Here

    @Override
    protected void doPost( HttpServletRequest request, HttpServletResponse response ) throws ServletException, IOException {
        bzb = new BooksZenBooks( "en", dbConfigResource ); // @TODO language should be a request param
        String forwardUrl = jspPath + "home";
        RequestDispatcher dispatcher;
        User user = bzb.getAuthenticatedUser( request );

        /* Load necessary lexicons */
        bzb.getLexicon().load( "manager" );
        bzb.getLexicon().load( "lexicon" );

View Full Code Here

    @Override
    protected void doPost( HttpServletRequest request, HttpServletResponse response ) throws ServletException, IOException {
        bzb = new BooksZenBooks( "en", dbConfigResource ); // @TODO language should be a request param
        String forwardUrl = jspPath + "home";
        RequestDispatcher dispatcher;
        User user = bzb.getAuthenticatedUser( request );

        /* Load necessary lexicons */
        bzb.getLexicon().load( "manager" );
        bzb.getLexicon().load( "book" );

View Full Code Here

    @Override
    protected void doPost( HttpServletRequest request, HttpServletResponse response ) throws ServletException, IOException {
        bzb = new BooksZenBooks( "en", dbConfigResource ); // @TODO language should be a request param
        String forwardUrl = jspPath + "home";
        RequestDispatcher dispatcher;
        User user = bzb.getAuthenticatedUser( request );

        /* Load necessary lexicons */
        bzb.getLexicon().load( "manager" );
        bzb.getLexicon().load( "settings" );

View Full Code Here

    @Override
    protected void doPost( HttpServletRequest request, HttpServletResponse response ) throws ServletException, IOException {
        bzb = new BooksZenBooks( "en", dbConfigResource ); // @TODO language should be a request param
        String forwardUrl = jspPath + "home";
        RequestDispatcher dispatcher;
        User user = bzb.getAuthenticatedUser( request );

        /* Load necessary lexicons */
        bzb.getLexicon().load( "manager" );
        bzb.getLexicon().load( "user" );

View Full Code Here

    public static User getUser(String emailAddress, String filename) throws IOException
    {
        File file = new File(filename);
        BufferedReader in = new BufferedReader(
                new FileReader(file));
        User user = new User();
        String line = in.readLine();
        while (line != null)
        {
            StringTokenizer t = new StringTokenizer(line, "|");
            String email = t.nextToken();
            if (email.equalsIgnoreCase(emailAddress))
            {
                String firstName = t.nextToken();
                String lastName = t.nextToken();
                String passWord = t.nextToken();
                user.setEmailAddress(emailAddress);
                user.setFirstName(firstName);
                user.setLastName(lastName);
                user.setPassWord(passWord);
            }
            line = in.readLine();
        }
        in.close();
        return user;
View Full Code Here

            StringTokenizer t = new StringTokenizer(line, "|");
            String emailAddress = t.nextToken();
            String firstName = t.nextToken();
            String lastName = t.nextToken();
            String passWord = t.nextToken();
            User user = new User(firstName, lastName, emailAddress,passWord);
            users.add(user);
            line = in.readLine();
        }
        in.close();
        return users;
View Full Code Here

        String firstName = request.getParameter("firstName");
        String lastName = request.getParameter("lastName");
        String emailAddress = request.getParameter("emailAddress");
        String passWord = request.getParameter("pw");
        // create the User object
        User user = new User();
        user.setFirstName(firstName);
        user.setLastName(lastName);
        user.setEmailAddress(emailAddress);
        user.setPassWord(passWord);

        // write the User object to a file
        ServletContext sc = getServletContext();
        String path = sc.getRealPath("/WEB-INF/EmailList.txt");
        UserIO.addRecord(user, path);
View Full Code Here

TOP

Related Classes of business.User

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.