Examples of Album


Examples of org.richfaces.photoalbum.model.Album

        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

Examples of org.richfaces.photoalbum.model.Album

    }

    @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

Examples of org.richfaces.photoalbum.model.Album

    @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

Examples of org.richfaces.photoalbum.model.Album

        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

Examples of org.richfaces.photoalbum.model.Album

     *
     * @param image - image to delete
     * @throws PhotoAlbumException
     */
    public void deleteImage(Image image) throws PhotoAlbumException {
        Album parentAlbum = em.find(Album.class, image.getAlbum().getId());
        try {
            parentAlbum.removeImage(image);
            em.merge(parentAlbum);
            em.flush();

            // the image will be sent in an event
            image.setAlbum(parentAlbum);
        } catch (Exception e) {
            parentAlbum.addImage(image);
            throw new PhotoAlbumException(e.getMessage());
        }
    }
View Full Code Here

Examples of org.richfaces.photoalbum.model.Album

     * @param album - dragged album
     * @param pathOld - old path of album directory
     */
    public void renameAlbumDirectory(@Observes @EventType(Events.ALBUM_DRAGGED_EVENT) AlbumEvent ae) {
        String pathOld = ae.getPath();
        Album album = ae.getAlbum();
        File file = getFileByPath(pathOld);
        File file2 = getFileByPath(album.getPath());
        if (file2.exists()) {
            if (file2.isDirectory()) {
                FileManipulation.deleteDirectory(file2, false);
            } else {
                FileManipulation.deleteFile(file2);
View Full Code Here

Examples of org.richfaces.photoalbum.model.Album

     * Refresh state of given album
     *
     * @param album - album to Synchronize
     */
    public Album resetAlbum(Album album) {
        Album a = em.merge(album);
        em.refresh(a);
        return a;
    }
View Full Code Here

Examples of org.richfaces.photoalbum.model.Album

     */
    public void createAlbum(Shelf shelf, boolean isShowAlbumAfterCreate) {
        if (user == null) {
            return;
        }
        album = new Album();
        if (shelf == null) {
            if (model.getSelectedShelf() != null) {
                shelf = model.getSelectedShelf();
            } else if (user.getShelves().size() > 0) {
                shelf = user.getShelves().get(0);
View Full Code Here

Examples of org.richfaces.photoalbum.model.Album

        Object dragValue = dropEvent.getDragValue();
        Event event = (Event) dropEvent.getDropValue();

        if (dragValue instanceof Album) {
            Album album = (Album) dragValue;

            String pathOld = album.getPath();

            event.getShelf().addAlbum(album);

            try {
                albumAction.editAlbum(album);
View Full Code Here

Examples of org.richfaces.photoalbum.model.Album

            }
        }
    }

    private void createAlbum(String name, Event event) {
        album = new Album();
        album.setName(name);
        album.setShelf(event.getShelf());

        albumManager.addAlbum(album);
    }
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.