Package org.apache.olio.webapp.model

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


        logger.finer("***** PERSON-REST-ACTION:addFriend: " + USER_NAME_PARAM + "=" + userName +
                " and " + FRIEND_USER_NAME_PARAM + "=" + friendUserName);

        ModelFacade mf = (ModelFacade) context.getAttribute(MF_KEY);
        Person person = mf.addFriend(userName, friendUserName);

        logger.log(Level.FINER, "Person " + userName + " has been updated to add friend=" + friendUserName);
        return person;
    }
View Full Code Here


        return null;
    }

    public void updateAttendee(HttpServletRequest request, HttpServletResponse response,
            ModelFacade modelFacade, int mode) {
        Person person = SecurityHandler.getInstance().getLoggedInPerson(request);
        if (person == null) {
            // This is an error condition -- ignore
            return;
        }
        String sxEventId = request.getParameter("socialEventID");
        if (sxEventId == null) {
            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);
            }
View Full Code Here

        }
    }

    private void getAttendees(HttpServletRequest request, HttpServletResponse response,
            ModelFacade modelFacade) throws IOException {
        Person person = SecurityHandler.getInstance().getLoggedInPerson(request);
        String status = null;
        String uname = null;
        if (person == null) {
            // Check wehther the userName parameter is passed in
            uname = request.getParameter("userName");
            if (uname == null || uname.length() == 0);
            status = "not_logged_in";
        } else {
            uname = person.getUserName();
        }

        String sxEventId = request.getParameter("socialEventID");
        if (sxEventId == null) {
            throw new RuntimeException("Couldnot find event with socialEventID = " +
View Full Code Here

        String minutex = htUpload.get("minute");
        String timezonex = htUpload.get(TIMEZONE_PARAM);

        // SECURITY get submitter from session
        String submitterUserName = null;
        Person person = SecurityHandler.getInstance().getLoggedInPerson(request);
        if (person != null) {
            submitterUserName = person.getUserName();
        } else {
            // error, submitter must be there
            // you shouldn't be able to get here unless there is a hole in the security mechanism

            // ADDENDUM - need to ommenting out the security check for now
View Full Code Here

        Timestamp eventTimestamp = new Timestamp(localCal.getTimeInMillis());
        event.setEventTimestamp(eventTimestamp);

        // SECURITY get submitter from session
        String submitterUserName = null;
        Person person = SecurityHandler.getInstance().getLoggedInPerson(request);
        if (person != null) {
            submitterUserName = person.getUserName();
        } else {
            throw new RuntimeException("Unknown user");
        }

        String literaturex = htUpload.get(UPLOAD_LITERATURE_PARAM);
View Full Code Here

            eid = Integer.parseInt(eventID);
        } catch (Exception e) {
            throw new RuntimeException("Incorrect eventID = " + eventID);
        }

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

        int rating = 0;

        try {
            rating = Integer.parseInt(request.getParameter("rating"));
View Full Code Here

            eid = Integer.parseInt(eventID);
        } catch (Exception e) {
            throw new RuntimeException("Incorrect eventID");
        }

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

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

        SocialEvent event = modelFacade.updateSocialEventComment(person, eid, comment);
View Full Code Here

            throw new RuntimeException("Incorrect eventID or commentId. eventId = " +
                    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 = " +
View Full Code Here

    }
   
   
    public Person login(ServletContext servletContext, HttpServletRequest request, HttpServletResponse response, String userName, String password) {
         ModelFacade mf=(ModelFacade)servletContext.getAttribute(WebConstants.MF_KEY);
         Person person=mf.getPerson(userName);
         // person will be null if there is an error
         person=login(person, userName, password);
         if(person != null) {
            setLoggedInPerson(request, person);
         }
View Full Code Here

    }

    public boolean isPersonLoggedIn(HttpServletRequest request) {
        boolean bRet=false;
        HttpSession session=request.getSession();
        Person person=(Person)session.getAttribute(LOGGED_IN_PERSON);
        if(person != null) {
            bRet=true;
        }
        return bRet;
    }
View Full Code Here

TOP

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

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.