Examples of GalleryBean


Examples of com.lichtfragmente.beans.GalleryBean

                        PreparedStatement stmt=DBInterface.doQuery("SELECT id,name FROM gallery WHERE owner=?");
                        stmt.setInt(1,userid);
                        ResultSet result=stmt.executeQuery();

                        while (result.next()) {
                            GalleryBean temp=new GalleryBean();
                            temp.setId(result.getInt(1));
                            temp.setName(result.getString(2));

                            list.add(temp);
                        }

                        result.close();
View Full Code Here

Examples of com.lichtfragmente.beans.GalleryBean

            //user wants to see the gallery view
            //fetch the gallery ID from the request
            int galleryid=Integer.parseInt(request.getParameter("galleryid"));

            //load gallery into bean
            GalleryBean gallery=this.getGalleryById(galleryid);
            if (gallery!=null) {
                //add gallery to request
                request.setAttribute("gallery",gallery);
            } else{
                throw new ServletException("Gallery with ID "+galleryid+" not found");
View Full Code Here

Examples of com.lichtfragmente.beans.GalleryBean

     * @param galleryid The ID of the gallery one wants to view
     * @return A bean containing gallery information and images
     **/
    private GalleryBean getGalleryById(int galleryid)
    throws ServletException {
        GalleryBean temp=null;

        synchronized(this) {
            try {
                //select gallery details
                PreparedStatement stmt=DBInterface.doQuery("SELECT g.id,g.name,g.bgcolor,g.fontcolor,u.name " +
                                                           "FROM gallery g " +
                                                           "INNER JOIN users u ON g.owner=u.id " +
                                                           "WHERE g.id=?");
                stmt.setInt(1,galleryid);
                ResultSet result=stmt.executeQuery();

                //store information in bean
                if (result.next()) {
                    temp=new GalleryBean();

                    temp.setId(result.getInt(1));
                    temp.setName(result.getString(2));
                    temp.setBgcolor(result.getString(3));
                    temp.setFontcolor(result.getString(4));
                    temp.getUserBean().setName(result.getString(5));

                    result.close();
                    stmt.close();
                    result=null;
                    stmt=null;

                    //get images which are shown in this gallery
                    stmt=DBInterface.doQuery("SELECT i.id,i.title " +
                                             "FROM gallery_has_image ghi " +
                                             "INNER JOIN image i ON ghi.imageid=i.id " +
                                             "WHERE ghi.galleryid=? " +
                                             "ORDER BY RANDOM()");
                    stmt.setInt(1,galleryid);
                    result=stmt.executeQuery();

                    //store image bean in bean for gallery
                    Vector<ImageBean> images=new Vector<ImageBean>();
                    while (result.next()) {
                        ImageBean img=new ImageBean();

                        img.setId(result.getInt(1));
                        img.setTitle(result.getString(2));

                        images.add(img);
                    }

                    result.close();
                    stmt.close();

                    temp.setImages(images);
                }

                DBInterface.close();
            } catch (SQLException se) {
                throw new ServletException("Could not retrieve gallery: "+se.getMessage());
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.