Package com.lichtfragmente.beans

Examples of com.lichtfragmente.beans.UserBean


            } else {
                //this just delivers the normal account page (i.e. no modal dialog).
                //this view is never requested via AJAX
                HttpSession session=request.getSession();
                //get account details
                UserBean user=this.getAccountDetails((Integer)session.getAttribute("userid"));
                if (user!=null) {
                    request.setAttribute("user",user);

                    //fetch number of unread messages
View Full Code Here


            PreparedStatement stmt=DBInterface.doQuery("SELECT id,name,permissions FROM users ORDER BY name");
            ResultSet result=stmt.executeQuery();

            //wrap the results into beans and add them to the list
            while (result.next()) {
                UserBean temp=new UserBean();

                temp.setId(result.getInt(1));
                temp.setName(result.getString(2));
                temp.setPermissions(result.getInt(3));

                list.add(temp);
            }

            result.close();
View Full Code Here

    private UserBean getAccountDetails(Integer userid) {
        if (userid==null) {
            return null;
        }

        UserBean temp=new UserBean();

        synchronized(this) {
            try {
                PreparedStatement stmt=DBInterface.doQuery("SELECT * FROM users WHERE id=?");
                stmt.setInt(1,userid);
                ResultSet result=stmt.executeQuery();

                if (result.next()) {
                    temp.setId(userid);
                    temp.setName(result.getString("name"));
                    temp.setEmail(result.getString("email"));
                    temp.setFirstname(result.getString("firstname"));
                    temp.setLastname(result.getString("lastname"));
                    temp.setInfo(result.getString("info"));
                    temp.setPermissions(result.getInt("permissions"));
                }
            } catch (SQLException se) {}
       }

       return temp;
View Full Code Here

        if (GlobalHelpers.isLoggedIn(request)) {
            //get user id from URL
            int userid=Integer.parseInt(request.getParameter("user"));

            //get user information
            UserBean userinfo=this.getUserInformation(userid);
            request.setAttribute("user",userinfo);

            //get featured image randomly
            ImageBean featured=this.getFeatured(userid);
            request.setAttribute("featured",featured);
View Full Code Here

     * @param userid The user's ID we want to obtain information of
     * @return The user information wrapped into a bean
     **/
    private UserBean getUserInformation(int userid)
    throws ServletException {
        UserBean temp=new UserBean();

        synchronized(this) {
            try {
                //request information
                PreparedStatement stmt=DBInterface.doQuery("SELECT name,info,firstname,lastname FROM users WHERE id=?");
                stmt.setInt(1,userid);
                ResultSet result=stmt.executeQuery();

                //store result
                if (result.next()) {
                    temp.setId(userid);
                    temp.setName(result.getString("name"));
                    temp.setInfo(GlobalHelpers.nl2br(result.getString("info")));
                    temp.setFirstname(result.getString("firstname"));
                    temp.setLastname(result.getString("lastname"));
                } else {
                    throw new ServletException("User with ID "+userid+" not found!");
                }

                result.close();
View Full Code Here

                stmt.setInt(1,userid);
                ResultSet result=stmt.executeQuery();

                //store information and add it to list
                while (result.next()) {
                    UserBean temp=new UserBean();

                    temp.setId(result.getInt(1));
                    temp.setName(result.getString(2));

                    list.add(temp);
                }
            } catch (SQLException se) {
                throw new ServletException("Could not retrieve follower information! "+se.getMessage());
View Full Code Here

                stmt.setInt(1,userid);
                ResultSet result=stmt.executeQuery();

                //store result in a list of beans
                while (result.next()) {
                    UserBean temp=new UserBean();

                    temp.setId(result.getInt(1));
                    temp.setName(result.getString(2));

                    list.add(temp);
                }

                result.close();
View Full Code Here

TOP

Related Classes of com.lichtfragmente.beans.UserBean

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.