Package org.apache.olio.webapp.model

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


    /*
     * example url = http://localhost:8080/webapp/api/person?user_name=bob123
     **/
    private Person getPerson(HttpServletRequest request) {
        String userName = request.getParameter(USER_NAME_PARAM);
        ModelFacade mf = (ModelFacade) context.getAttribute(MF_KEY);
        Person person = mf.getPerson(userName);
        return person;
    }
View Full Code Here


    /*
     * example url = http://localhost:8080/webapp/api/person?user_name=bob123
     **/
    private Person getFriend(HttpServletRequest request) {
        String userName = request.getParameter(FRIEND_PARAM);
        ModelFacade mf = (ModelFacade) context.getAttribute(MF_KEY);
        Person person = mf.getPerson(userName);
        logger.finer("inside getFriend - the friend's username is " + person.getUserName());
        return person;
    }
View Full Code Here

                " first_name=*" + firstName +
                " last_name" + lastName +
                " summary" + summary);

        Person person = new Person(userName, password, firstName, lastName, summary, email, telephone, imageURL, thumbImage, timezone, null);
        ModelFacade mf = (ModelFacade) context.getAttribute(MF_KEY);
        //do not really need username since you set this value, not sure why it is returned
        //String userName = mf.addPerson(person, userSignOn);
        //changed above line to this since username already a variable name
        //userName = mf.addPerson(person, userSignOn);

        userName = mf.addPerson(person);
        logger.log(Level.FINER, "Person " + userName + " has been persisted");
        // retrieve again ???
        //person=mf.getPerson(userName);
        // login person
        SecurityHandler.getInstance().setLoggedInPerson(request, person);
View Full Code Here

        thumbImage = htUpload.get(UPLOAD_PERSON_IMAGE_THUMBNAIL_PARAM);

        //if these fields are null, then reuse the old file information stored

        //Person loggedInPerson = this.getPerson(request);
        ModelFacade mf = (ModelFacade) context.getAttribute(MF_KEY);
        Person loggedInPerson = mf.getPerson(userName);
        if (loggedInPerson != null) {
            if (thumbImage == null) {
                thumbImage = loggedInPerson.getImageThumbURL();
            }
            if (imageURL == null) {
                imageURL = loggedInPerson.getImageURL();
            }
        }

        logger.finer("************** data entered is*** " + "user_name*" + userName +
                " password=" + password +
                " first_name=" + firstName +
                " last_name=" + lastName +
                " summary=" + summary + " thumbUrl=" + thumbImage +
                " imageURL=" + imageURL);
        //Person person = new Person(userName, password, firstName, lastName, summary, email, telephone, imageURL, thumbImage, timezone, address);
        //ModelFacade mf= (ModelFacade) context.getAttribute(MF_KEY);
        //do not really need username since you set this value, not sure why it is returned
        //String userName = mf.addPerson(person, userSignOn);
        //changed above line to this since username already a variable name
        //userName = mf.addPerson(person, userSignOn);

        // Update person with all field values
        person.setUserName(userName);
        person.setPassword(password);
        person.setAddress(address);
        person.setTimezone(timezone);
        person.setTelephone(telephone);
        person.setFirstName(firstName);
        person.setLastName(lastName);
        person.setSummary(summary);
        person.setImageURL(imageURL);
        person.setImageThumbURL(thumbImage);
        person = mf.updatePerson(person);
        logger.log(Level.FINER, "Person " + userName + " has been updated");

        return person;
    }
View Full Code Here

    public EventAction(ServletContext con) {
        this.context = con;
    }

    public String process(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        ModelFacade mf= (ModelFacade) context.getAttribute(MF_KEY);
        String path = request.getPathInfo();
    if (path.equals("/list")) {
            return listEvents (request, response, mf);
        }
        if (path.equals("/addEvent") || path.equals("/updateEvent")) {
            return addEvent (request, response);
        }
        if (path.equals("/upcoming")) {
            return listUpcomingEvents (request, response, mf);
        }
       
        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

                " last_name" + lastName +
                " summary" + summary);

        Person person = new Person(userName, password, firstName, lastName, summary, email, telephone, imageURL, imageThumbURL, timezone, address);

        ModelFacade mf = (ModelFacade) context.getAttribute(MF_KEY);

        //do not really need username since you set this value, not sure why it is returned
        //String userName = mf.addPerson(person, userSignOn);
        //changed above line to this since username already a variable name
        //userName = mf.addPerson(person, userSignOn);
        userName = mf.addPerson(person);
        logger.log(Level.FINER, "Person " + userName + " has been persisted");
        return mf.getPerson(userName);
    }
View Full Code Here

           
        return "/site.jsp?page=event.jsp&socialEventID=" + eventID;
        }

    private String deleteEvent (int eid, HttpServletRequest request, HttpServletResponse response) throws IOException {
        ModelFacade mf= (ModelFacade) context.getAttribute(MF_KEY);
        mf.deleteEvent(eid);
        // Since this affects the cache, clear the cache
        WebappUtil.clearCache("/event/list");
        response.sendRedirect(request.getContextPath() + "/event/list");
        return null;
    }
View Full Code Here

        String timezone = "";
        Address address = new Address();

        Person person = new Person(userName, password, firstName, lastName, summary, email, telephone, imageURL, imageThumbURL, timezone, address);

        ModelFacade mf = (ModelFacade) context.getAttribute(MF_KEY);
        person = mf.updatePerson(person);

        logger.log(Level.FINER, "Person " + userName + " has been updated");
        return person;
    }
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
       
View Full Code Here

    }

    private void deleteUser(HttpServletRequest request) {
        //String personId = request.getParameter(PERSON_ID_PARAM);
        String userName = request.getParameter(USER_NAME_PARAM);
        ModelFacade mf = (ModelFacade) context.getAttribute(MF_KEY);
        mf.deletePerson(userName);
        logger.log(Level.FINER, "Person " + userName + " has been deleted");
    }
View Full Code Here

TOP

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

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.