Package org.apache.olio.webapp.fileupload

Examples of org.apache.olio.webapp.fileupload.FileUploadHandler


            logger.finer("\n*** pathinfo = " + path);

            ModelFacade modelFacade = (ModelFacade) context.getAttribute(MF_KEY);
            if (path.equals("/person/fileuploadPerson")) {
                // file upload
                FileUploadHandler fuh = new FileUploadHandler();
                Hashtable<String, String> htUpload = fuh.getInitialParams(request, response);

                // file is upload check for error and then write to database
                if (htUpload != null) {
                    /*
                    StringBuilder sb = new StringBuilder();
                    for (String key : htUpload.keySet()) {
                        sb.append(key);
                        sb.append(",");
                    }
                    */
                    //logger.finer("\n***elements  = " + sb.toString());

                    //createUser(request, htUpload);
                    // just for now comment out the above line
                    // need to check if fileupload is complete
                    Person newEditPerson = null;
                    boolean isEditable = Boolean.parseBoolean(request.getParameter("isEditable"));

                    if (isEditable) {
                        newEditPerson = getPerson(request);
                    } else {
                        newEditPerson = createUser(request, htUpload, fuh);
                    }

                    logger.log(Level.FINER, "A new Person has been added and persisted");
                    request.setAttribute("displayPerson", newEditPerson);

                    String id = String.valueOf(newEditPerson.getUserID());
                    htUpload = fuh.handleFileUpload(id, request, response);

                    updateUser(newEditPerson, htUpload);
                }
                return "/site.jsp?page=personContent.jsp";

View Full Code Here


        } else if (path.equals("/event/deleteCommentsRating")) {
            deleteSocialEventComment(request, response, modelFacade);
        } else if (path.equals("/event/addEvent") || path.equals("updateEvent")) {
            // file upload
            logger.finer("AddEvent ... ");
            FileUploadHandler fuh = new FileUploadHandler();
            Hashtable<String, String> htUpload = fuh.getInitialParams(request, response);

            // file is upload check for error and then write to database
            if (htUpload != null) {
                StringBuilder sb = new StringBuilder();
                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
View Full Code Here

TOP

Related Classes of org.apache.olio.webapp.fileupload.FileUploadHandler

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.