Package org.richfaces.photoalbum.model

Examples of org.richfaces.photoalbum.model.Event


    public void createEvent() {
        if (user == null) {
            return;
        }
        newEvent = new Event();
        ecId = 1;

        newShelf = new Shelf();
    }
View Full Code Here


        if (user == null) {
            return;
        }

        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);
                eventAction.editEvent(event);
            } catch (PhotoAlbumException e) {
View Full Code Here

    public List<EventCategory> getEventCategories() {
        return em.createNamedQuery("event-categories").getResultList();
    }

    public Event getEventById(long id) {
        Event event = null;
        try {
            event = (Event) em.createNamedQuery("event-by-id").setParameter("id", id).getSingleResult();
        } catch (NoResultException nre) {
            // do nothing
        }
View Full Code Here

        return ec;
    }

    @Override
    public Event getEventByName(String name) {
        Event event = null;
        try {
            event = (Event) em.createNamedQuery("event-by-name").setParameter("name", name).getSingleResult();
        } catch (NoResultException nre) {
            // do nothing
        }
View Full Code Here

    @GET
    @Path("/{id:[0-9][0-9]*}")
    @Produces(APPLICATION_JSON)
    public Event lookupEventById(@PathParam("id") long id) {
        Event event = evm.getEventById(id);
        if (event == null) {
            throw new WebApplicationException(Response.Status.NOT_FOUND);
        }

        return event;
View Full Code Here

        pBarValue = (count * 100) / size;
        pBarText = count + " / " + size;
    }

    public void finishDownload() {
        Event event = album.getShelf().getEvent();

        // save the album
        try {
            albumAction.editAlbum(album);
            album = albumAction.resetAlbum(album);
        } catch (PhotoAlbumException pae) {
            error.fire(new ErrorEvent("Error", "error saving album<br/>" + pae.getMessage()));
        }

        // remove the remote album from the event
        if (event.getRemoteAlbumIds().contains("F" + albumId)) {
            event.getRemoteAlbumIds().remove("F" + albumId);
        } else if (event.getRemoteAlbumIds().contains("G" + albumId)) {
            event.getRemoteAlbumIds().remove("G" + albumId);
        }

        try {
            eventAction.editEvent(event);
        } catch (PhotoAlbumException pae) {
View Full Code Here

    public void init(@Observes @EventType(Events.EVENT_DISPLAYED_EVENT) SimpleEvent se) {
        images = new ArrayList<ImageHandler>();
        setFacebookNeedsUpdate(false);
        setGoogleNeedsUpdate(false);

        Event event = model.getSelectedEvent();

        // add local images into the list
        for (Image i : event.getShelf().getImages()) {
            images.add(new ImageHandler(i));
        }

        /*
         * Facebook
         */

        List<String> facebookIds = event.getFacebookAlbumIds();

        if (facebookIds.size() != 0) {
            // check if albums are loaded
            emptyFacebookIds = new ArrayList<String>(Collections2.filter(facebookIds, new Predicate<String>() {

                @Override
                public boolean apply(String id) {
                    return !fac.isAlbumLoaded(id);
                }
            }));

            facebookAlbumIds = new ArrayList<String>(Collections2.filter(facebookIds, new Predicate<String>() {

                @Override
                public boolean apply(String id) {
                    return fac.isAlbumLoaded(id);
                }
            }));

            // set up the id
            setFbAlbumIds(ListConverter.sListToString(emptyFacebookIds));

            // load the loaded images
            for (String lId : facebookAlbumIds) {
                for (JSONObject fImage : fac.getImagesFromAlbum(lId)) {
                    images.add(new ImageHandler(fImage));
                }
            }

            setFacebookNeedsUpdate(emptyFacebookIds.size() > 0);
        }

        /*
         * Google+
         */

        emptyGoogleIds = new LinkedList<String>();
        googleAlbumIds = new ArrayList<String>();

        googleAlbumIds = event.getGooglePlusAlbumIds();

        if (googleAlbumIds.size() != 0) {

            for (String fullId : googleAlbumIds) {
                if (!gpac.isAlbumLoaded(fullId)) {
View Full Code Here

TOP

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

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.