Package org.itcr.myguru.model

Examples of org.itcr.myguru.model.Location


            return;
        }
       
        // Business logic
        //  :: Find Location by code
        Location loc = dao.findLocationByCode(code);
        if(loc == null) {
            return;
        }
       
        // Add location to user expertise
        boolean hasExpertise = user.hasExpertise(loc);
        if(action.equals("add")) { // Add
            // Do nothing if user is already expert
            if(hasExpertise) {
                return;
            }
            user.addExpertise(loc);
           
        } else { // Remove
            // Do nothing if user is already expert
            if(!hasExpertise) {
                return;
            }
            user.removeExpertise(loc);
        }
       
        try {
            dao.persistChanges(user);
        } catch(Exception e) {
            e.printStackTrace();
            return;
        }
        String contextPath = request.getContextPath();
        PrintWriter out = response.getWriter();
        if(action.equals("add")) {
            out.println("<li id=\"expertise_" + loc.getCode() + "\">");
            out.println("    <span class=\"expertise_name\">" + loc.toString() + "</span> |");
            out.println("    <a class=\"expertise_remove\" href=\"" + contextPath + "/expertise/remove\">Eliminar</a>");
            out.println("</li>");
        } else { // Remove
            out.println("<option value=\"" + loc.getCode() + "\">" + loc.toString() + "</option>");
        }
        out.flush();
        out.close();
        return;
    }
View Full Code Here


                        out.println("ERROR:: Ignorando la localidad " + code + " pues ya fue procesada en este mismo batch.");
                        continue;
                    }
                   
                    // Get location from database
                    Location loc = dao.findLocationByCode(code);
                   
                    // Location not found, create a new one.
                    if(loc == null) {
                        out.println("INFO :: Localidad " + code + " no fue encontrada, se procede a agregarla.");
                        Location newloc = new Location();
                        newloc.setCode(code);
                        newloc.setCountry(country);
                        newloc.setState(state);
                        newloc.setCity(city);
                        newloc.setEnabled(true);
                        try {
                            dao.save(newloc);
                            out.println("INFO :: Localidad " + code + " agregada a la base de datos.");
                        } catch(Exception e) {
                            out.println("ERROR:: La localidad " + code + " no pudo ser agregada.");
View Full Code Here

TOP

Related Classes of org.itcr.myguru.model.Location

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.