Package org.richfaces.photoalbum.model

Examples of org.richfaces.photoalbum.model.Album


     * This method observes <code>Constants.ALBUM_ADDED_EVENT</code> and invoked after the user add new album
     *
     * @param album - added album
     */
    public void onAlbumAdded(@Observes @EventType(Events.ALBUM_ADDED_EVENT) AlbumEvent ae) {
        Album album = ae.getAlbum();
        if (album.isShowAfterCreate()) {
            model.resetModel(NavigationEnum.ALBUM_PREVIEW, album.getOwner(), album.getShelf(), album, null, album.getImages());
        }
    }
View Full Code Here


     * This method observes <code>Constants.ALBUM_EDITED_EVENT</code> and invoked after the user edit her album
     *
     * @param album - edited album
     */
    public void onAlbumEdited(@Observes @EventType(Events.ALBUM_EDITED_EVENT) AlbumEvent ae) {
        Album album = ae.getAlbum();
        model.resetModel(NavigationEnum.ALBUM_PREVIEW, model.getSelectedUser(), model.getSelectedShelf(), album, null,
            album.getImages());
    }
View Full Code Here

     * @param image - deleted image
     * @param path - relative path of the image file
     */
    public void onImageDeleted(@Observes @EventType(Events.IMAGE_DELETED_EVENT) ImageEvent ie) {
        loggedUserBean.refreshUser();
        Album album = ie.getImage().getAlbum();
        model.resetModel(NavigationEnum.ALBUM_PREVIEW, getLoggedUser(), album.getShelf(), album, null, album.getImages());
    }
View Full Code Here

        if (!(getLoggedUser().getShelves().size() > 0)) {
            // If user have no shelves, that can start fileupload process
            showError("", Constants.FILE_UPLOAD_SHOW_ERROR);
            return;
        }
        Album alb = null;
        // If selected album belongs to user
        alb = setDefaultAlbumToUpload(alb);
        model.resetModel(NavigationEnum.FILE_UPLOAD, getLoggedUser(), alb != null ? alb.getShelf() : null, alb, null,
            alb != null ? alb.getImages() : null);
    }
View Full Code Here

            if (a.getName().equals(value)) {
                return a;
            }
        }

        return new Album();
    }
View Full Code Here

        Shelf shelf = em.createQuery("select s from Shelf s order by s.id", Shelf.class).getResultList().get(0);

        Assert.assertNotNull(shelf);

        Album newAlbum = new Album();
        newAlbum.setName("new album");
        newAlbum.setDescription("new album description");
        newAlbum.setShelf(shelf);
        newAlbum.setCreated(new Date());

        aa.addAlbum(newAlbum);

        Assert.assertTrue(helper.getAllAlbums(em).contains(newAlbum));
        Assert.assertEquals(originalSize + 1, helper.getAllAlbums(em).size());
View Full Code Here

        Assert.assertEquals(originalSize + 1, helper.getAllAlbums(em).size());
    }

    @Test
    public void isAlbumEdited() throws Exception {
        Album album = helper.getAllAlbums(em).get(0);

        album.setName("edited album");

        int originalSize = helper.getAllAlbums(em).size();

        aa.editAlbum(album);

        Album editedAlbum = helper.getAllAlbums(em).get(0);
        Assert.assertEquals(album.getId(), editedAlbum.getId());
        Assert.assertEquals("edited album", editedAlbum.getName());
        Assert.assertEquals(originalSize, helper.getAllAlbums(em).size());
    }
View Full Code Here

    }

    @Test
    public void areImagesDeletedWithAlbum() throws Exception {
        String imageById = "select i from Image i where album_id = :id";
        Album album = helper.getAllAlbums(em).get(0);

        Assert.assertNotNull(album);

        int allImagesSize = helper.getAllImages(em).size();
        int imagesSize = em.createQuery(imageById, Image.class).setParameter("id", album.getId()).getResultList().size();

        aa.deleteAlbum(album);

        Assert.assertFalse(helper.getAllAlbums(em).contains(album));

        List<Image> images = em.createQuery(imageById, Image.class).setParameter("id", album.getId()).getResultList();

        Assert.assertTrue(images.isEmpty());
        Assert.assertEquals(allImagesSize - imagesSize, helper.getAllImages(em).size());
    }
View Full Code Here

    @Test
    public void isImageAdded() throws Exception {

        int originalSize = helper.getAllImages(em).size();

        Album album = em.createQuery("select a from Album a where a.id = :id", Album.class).setParameter("id", (long) 0)
            .getSingleResult();
        Image newImage = new Image();

        newImage.setName("839245545_5db77619d5_o.jpg");
        newImage.setPath("839245545_5db77619d5_o.jpg");
View Full Code Here

        Assert.assertTrue("suggestion for '" + parts[1] + "'", suggestedTags.isEmpty());
    }

    @Test
    public void doesImageWithSamePathExist() throws Exception {
        Album album1 = helper.getAllAlbums(em).get(0);
        Album album2 = helper.getAllAlbums(em).get(1);

        String path = album1.getImages().get(0).getPath();

        Assert.assertTrue(ia.isImageWithThisPathExist(album1, path));
View Full Code Here

TOP

Related Classes of org.richfaces.photoalbum.model.Album

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.