Package org.apache.olio.webapp.model

Examples of org.apache.olio.webapp.model.SocialEvent


       
        String eventID = request.getParameter("socialEventID");
        int eid = this.getSocialEventID(eventID);
       
        if (path.equals("/detail")) {
            SocialEvent se = mf.getSocialEvent(eid);
            if (se == null)
                throw new RuntimeException("Could not find event. eventID = " + eid);

            request.setAttribute("socialEvent", se);
            boolean attending = false;
            Person user = SecurityHandler.getInstance().getLoggedInPerson(request);

            if (user != null)
                attending = se.isAttending(user);

            request.setAttribute("isAttending", attending);

            // If the user is looged in get the comment if there is any
            if (user != null) {
                CommentsRating cr = mf.getCommentRating(user, se);
                if (cr != null && cr.getCommentString() != null) {
                    request.setAttribute("comment", cr.getCommentString());
                }
            }
            return "/site.jsp?page=event.jsp";
        }
        if (path.equals("/delete"))
            return deleteEvent(eid, request, response);

        Person person=SecurityHandler.getInstance().getLoggedInPerson(request);
        String comments = request.getParameter("comments");

        SocialEvent event = mf.updateSocialEventComment(person, eid, comments, 0);
           
        return "/site.jsp?page=event.jsp&socialEventID=" + eventID;
        }
View Full Code Here


        if (eventID == null)
            return "/site.jsp?page=addEvent.jsp";
       
        int eid = getSocialEventID (eventID);
        ModelFacade mf= (ModelFacade) context.getAttribute(MF_KEY);
        SocialEvent event = mf.getSocialEvent(eid);
        if (event == null)
            return "/site.jsp?page=addEvent.jsp";
       
        // Only the original submitter can edit an event
       
        if (!person.getUserName().equals(event.getSubmitterUserName())) {
            request.setAttribute("errorMessage", "Only the user that submitted the event can edit an event.");
            return "/site.jsp?page=error.jsp";
        }
        // Set the necessary fields
        //request.setAttribute("title", event.getTitle());
        request.setAttribute("title", event.getTitle());
        request.setAttribute("summary", event.getSummary());
        request.setAttribute("description", event.getDescription());
        request.setAttribute("telephone", event.getTelephone());
        request.setAttribute("tags", event.getTagsAsString());
        if (event.getAddress() != null) {
            request.setAttribute("street1", event.getAddress().getStreet1());
            request.setAttribute("street2", event.getAddress().getStreet2());
            request.setAttribute("zip", event.getAddress().getZip());
            request.setAttribute("city", event.getAddress().getCity());
            request.setAttribute("state", event.getAddress().getState());
            request.setAttribute("country", event.getAddress().getCountry());
        }
        request.setAttribute("socialEvent", event);
        return "/site.jsp?page=addEvent.jsp";
    }
View Full Code Here

                for (String key : htUpload.keySet()) {
                    sb.append(key);
                    sb.append(comma);
                }
                logger.finer("\n***elements  = " + sb.toString());
                SocialEvent event = null;
                /* Don't check for submit since we're doing upload in 2 phases
                 * and we may not have read it in. We don't do updates.
                String type = htUpload.get("submit");
                if (type == null) {
                    return "/site.jsp?page=error.jsp";
                }
                if (type.equals("Update")) {
                    event = getEvent(modelFacade, htUpload);
                } else {
                */
                event = createEvent(request, modelFacade, htUpload);
                    if (request.getSession(true).getAttribute("userBean") != null) {
                        UserBean uBean = (UserBean) request.getSession(true).getAttribute("userBean");
                        uBean.setDisplayMessage("Event added successfully");
                        logger.log(Level.FINER, "A new Event has been added and persisted");
                    }
                //}

                String id = String.valueOf(event.getSocialEventID());
                htUpload = fuh.handleFileUpload(id, request, response);

                // Update the event with the right stuff.
                updateEvent(event, request, modelFacade, htUpload);

                // clear the cache
                WebappUtil.clearCache("/event/list");
                response.sendRedirect(request.getContextPath() + "/event/detail?socialEventID=" + event.getSocialEventID());
                return null;
            }
        } else if (path.equals("/event/fileuploadEventFinal")) {
            // file upload status request
            FileUploadHandler.handleFileUploadFinal(request, response);
View Full Code Here

            throw new RuntimeException("Couldnot find event with socialEventID = " +
                    sxEventId);
        }
        try {
            int eventId = Integer.parseInt(sxEventId);
            SocialEvent event = modelFacade.getSocialEvent(eventId);
            if (event == null) {
                throw new RuntimeException("Couldnot find event with socialEventID = " +
                        eventId);
            }

            boolean attending = event.isAttending(person);

            boolean already = false;
            String status = "success";
            if (mode == UPDATE_MODE_ADD_ATTENDEE && attending) {
                already = true;
                status = "attending";
            }
            if (!attending && mode == UPDATE_MODE_DELETE_ATTENDEE) {
                already = true;
                status = "not_attending";
            }

            if (!already) {
                if (mode == UPDATE_MODE_ADD_ATTENDEE) {
                    event.getAttendees().add(person);
                    person.getSocialEvents().add(event);
                    status = "added";
                } else {
                    event.getAttendees().remove(person);
                    person.getSocialEvents().remove(event);
                    status = "deleted";
                }

                modelFacade.updateSocialEvent(event);
            }
            String s = getAttendeesAsJson(event.getAttendees(), status);

            logger.finer("\n*** people = " + s);
            response.setContentType("application/json;charset=UTF-8");
            response.setHeader("Cache-Control", "no-cache");
            response.getWriter().write(s);
View Full Code Here

        String sxEventId = request.getParameter("socialEventID");
        if (sxEventId == null) {
            throw new RuntimeException("Couldnot find event with socialEventID = " +
                    sxEventId);
        }
        SocialEvent event = null;
        try {
            int eventId = Integer.parseInt(sxEventId);
            event = modelFacade.getSocialEvent(eventId);
            if (event == null) {
                throw new RuntimeException("Couldnot find event with socialEventID = " +
                        eventId);
            }
        } catch (Exception e) {
            throw new RuntimeException("Couldnot find event with socialEventID = " +
                    sxEventId);
        }
        if (uname != null && uname.length() > 0) {
            if (event.isAttending(uname)) {
                status = "attending";
            } else {
                status = "not_attending";
            }
        }

        String s = getAttendeesAsJson(event.getAttendees(), status);
        // Faban does not understand the content type application/json
        //response.setContentType("application/json;charset=UTF-8");
        response.setContentType("text/plain;charset=UTF-8");
        response.setHeader("Cache-Control", "no-cache");
        response.getWriter().write(s);
View Full Code Here

        localCal.set(Calendar.MINUTE, Integer.parseInt(minutex));
        localCal.set(Calendar.SECOND, 0);
        logger.finer("\n***local = " + localCal + "\n Millis = " + localCal.getTimeInMillis());
        Timestamp eventTimestamp = new Timestamp(localCal.getTimeInMillis());

        SocialEvent socialEvent = new SocialEvent(title, summary, description, submitterUserName, null, telephone, 0, 0,
                imagex, thumbImage, literaturex, eventTimestamp);
        logger.finer("Event title = " + socialEvent.getTitle());


        // Submitter is not necessarily an attendde

        socialEvent = modelFacade.addSocialEvent(socialEvent, tags);
        logger.log(Level.FINER, "SocialEvent " + socialEvent.getSocialEventID() + " has been persisted");

        return socialEvent;
    }
View Full Code Here

        try {
            rating = Integer.parseInt(request.getParameter("rating"));
        } catch (Exception e) {
        }

        SocialEvent event = modelFacade.updateSocialEventRating(person, eid, rating);

        /*
        response.setContentType("text/json");
        PrintWriter out = response.getWriter();
        out.print("{\"commentsratings\":[");
View Full Code Here

        out.flush();
    }

    public void getSocialEventComments(HttpServletRequest request, HttpServletResponse response, ModelFacade modelFacade) throws IOException {
        String eventID = request.getParameter("socialEventID");
        SocialEvent event = null;
        try {
            int eid = Integer.parseInt(eventID);
            event = modelFacade.getSocialEvent(eid);
        } catch (Exception e) {
            throw new RuntimeException("coulnot locate event -- eventID = " + eventID);
View Full Code Here

        Person person = SecurityHandler.getInstance().getLoggedInPerson(request);

        String comment = request.getParameter("comment");

        SocialEvent event = modelFacade.updateSocialEventComment(person, eid, comment);

        response.setContentType("application/json;charset=UTF-8");
        response.setHeader("Cache-Control", "no-cache");
        PrintWriter out = response.getWriter();
        out.print(getCommentsRatingAsJson(event));
View Full Code Here

                    request.getParameter("socialEventID") + " commentId = " +
                    request.getParameter("commentId"));
        }

        Person person = SecurityHandler.getInstance().getLoggedInPerson(request);
        SocialEvent event = modelFacade.getSocialEvent(eid);

        if (event == null) {
            throw new RuntimeException("Incorrect eventID or commentId. eventId = " +
                    request.getParameter("socialEventID") + " commentId = " +
                    request.getParameter("commentId"));
View Full Code Here

TOP

Related Classes of org.apache.olio.webapp.model.SocialEvent

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.