Package adios.model

Examples of adios.model.User


   @Override
   public boolean preHandle(HttpServletRequest request,
     HttpServletResponse response, Object handler) throws Exception
   {
    String uri = request.getRequestURI();
    User userData = (User) request.getSession().getAttribute(loginUser);

    if(uri.contains("/user/welcome.html")){
      return true;
    }
    if(uri.contains("user") && userData == null)
View Full Code Here


            throws ServletException, IOException {
        Log.info("signUpHandleRequest");

      ModelAndView view = new ModelAndView("html/loginPage");
     
      User user= new User();
      user.setMail(request.getParameter("mail"));
      user.setPassword(request.getParameter("pass"));
      user.setName(request.getParameter("name"));

      userService.signUpUser(user);
     
        return view;
  }
View Full Code Here

    @RequestMapping(value="/user/welcome.html", method = RequestMethod.POST)
    public ModelAndView loginPostHandleRequest(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        Log.info("/user/welcome.html");
        ModelAndView view;
        User u =new User();
        String name = request.getParameter("name");
        String pas = request.getParameter("password");
        if(pas != null && name != null){
            u.setName(name.toString());
            u.setPassword(pas.toString());
            User existingUser = userService.getUserForNameAndPas(u);
            if(existingUser != null){       
              request.getSession().setAttribute(loginUser, existingUser);
              view = new ModelAndView("html/userWellcome");
               return view;
            }
View Full Code Here

    @RequestMapping(value="/user/welcome.html", method = RequestMethod.GET)
  public ModelAndView userAlreadyLoggedin(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        Log.info("/user/welcome.html");
        ModelAndView view;
        User u =new User();
        String name = request.getParameter("name");
        String pas = request.getParameter("password");
        if(pas != null && name != null){
            u.setName(name.toString());
            u.setPassword(pas.toString());
            User existingUser = userService.getUserForNameAndPas(u);
            if(existingUser != null){       
              request.getSession().setAttribute(loginUser, existingUser);
              view = new ModelAndView("html/userWellcome");
               return view;
            }
        }

        User userData = (User) request.getSession().getAttribute(loginUser);
      if (userData!=null){
          view = new ModelAndView("html/userWellcome");                         
          return view;
      }
      view = new ModelAndView("html/loginPage");                 
View Full Code Here

  private static final Log Log = LogFactory.getLog(UserRole.class);

  public boolean start() {
    Log.info("StartUp Serice: filling up data");

    User u;
   
    try {
      Log.info(":::  insert user roles");
      UserRole role = new UserRole("ROLE_ADMIN");
      userRoleDao.persist(role);
      role = new UserRole("ROLE_USER");
      userRoleDao.persist(role);
    } catch (Exception es) {
      Log.error("exception, already in database");
    }

    try {
      Log.info(":::  insert user (admin/admin , wolf/wolf)");
      u = new User(0, "admin", "admin", true, "admin@admin.com",
          "ROLE_ADMIN", null,null);
      userDao.persist(u);
      u = new User(0, "wolf", "wolf", true, "wolf@wolf.com", "ROLE_USER", null, null);
      userDao.persist(u);
    } catch (Exception es) {
      Log.error("exception, already in database");
    }

    try {
      Log.info(":::  insert Recipes ");
      String name = "Pa amb Tomaquet";
      String desc = "El pan con tomate (pa amb tomàquet, pa amb tomata o pa amb oli en los distintos dialectos de la lengua catalana) es una típica receta de la cocina aragonesa, balear, catalana, similar a la bruschetta al pomodoro italiana. Está considerado como uno de los mejores ejemplos que definen la dieta mediterránea.";
      String externalMedia = "<iframe src='http://player.vimeo.com/video/19862257' width='500' height='281' frameborder='0' webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe> <p><a href='http://vimeo.com/19862257'>less is more | pa amb tomaquet | chleb z pomidorem</a> from <a href='http://vimeo.com/user2552887'>stokilo</a> on <a href='http://vimeo.com'>Vimeo</a>.</p>";     
      u = userDao.getUserForMail("wolf@wolf.com");
      int userId = u.getUserId();
      String imageName = u.getUserId()+name.replace(" ","");
      imageName = imageName+".jpg";
     
      ArrayList<String> instructions = new ArrayList();
      instructions
          .add("Se elabora frotando tomate crudo y maduro sobre una rebanada de pan, preferiblemente de pagès (pan de payés)");
      instructions.add("Coratar los tomates por la mitad");
      instructions.add("Untar el tomate");
      instructions.add("Aliñado al gusto con sal y aceite de oliva");

      Recipe recip = new Recipe(name, desc, externalMedia,imageName, userId,
          instructions);

      recipeDao.persist(recip);

      name=name+"2";
      imageName = u.getUserId()+name.replace(" ","");
      imageName = imageName+".jpg";

      recip = new Recipe(name, desc, externalMedia,imageName, userId, instructions);
      recipeDao.persist(recip);
     
View Full Code Here

              throws ServletException, IOException {
          Log.info("/user/receta/compra/lista.html");
        ModelAndView view = new ModelAndView("html/mainTemplate");        
         
         
          User u = (User)request.getSession().getAttribute(loginUser);
          u = userService.getUserForMail(u);
         
        ArrayList<Recipe> rList = new ArrayList<Recipe>();
          Map<Integer, Recipe>recipesCartMap = u.getCartRecipes();
          final Hashtable<String, Ingredient4Recipe> ingHT;
          if (recipesCartMap!= null){
            ingHT = new Hashtable<String, Ingredient4Recipe>(); ;
            Set<Integer> recipesIdSet = recipesCartMap.keySet();
            Iterator<Integer> recipesIdIter = recipesIdSet.iterator();
View Full Code Here

     
      @RequestMapping(value="/user/receta/compra/{recipeId}.html", method = RequestMethod.POST)
      public void addToShoppingList(@PathVariable int recipeId,HttpServletRequest request, HttpServletResponse response)
              throws ServletException, IOException {
          Log.info("/receta/compra/{recipeId}.html");
          User u = (User)request.getSession().getAttribute(loginUser);
          u = userService.getUserForMail(u);
         
          Integer i = Integer.valueOf(recipeId);
         
         
          HashMap<Integer, Recipe> cartMap = u.getCartRecipes();
          if(cartMap== null){
            cartMap = new HashMap<Integer, Recipe>();
          }
         
          if(!cartMap.containsKey(i)){
           
            cartMap.put(i, null);
            u.setCartRecipes(cartMap);
            u = userService.updateUser(u);
          request.getSession().setAttribute(loginUser,u);
          }
    }
View Full Code Here

       */
      @RequestMapping(value="/user/receta/favorita/{recipeId}.html", method = RequestMethod.POST)
      public void addRecipeToFavorite(@PathVariable int recipeId,HttpServletRequest request, HttpServletResponse response)
              throws ServletException, IOException {
          Log.info("/receta/favorita/{recipeId}.html");
          User u = (User)request.getSession().getAttribute(loginUser);
          u = userService.getUserForMail(u);
         
          Integer i = Integer.valueOf(recipeId);
         
         
          HashMap<Integer, Recipe> favsMap = u.getFavoriteRecipes();
          if(favsMap== null){
            favsMap = new HashMap<Integer, Recipe>();
          }
         
          if(!favsMap.containsKey(i)){
           
            favsMap.put(i, null);
            u.setFavoriteRecipes(favsMap);
            u = userService.updateUser(u);
          request.getSession().setAttribute(loginUser,u);
          }
    }
View Full Code Here

       */
      @RequestMapping(value="/user/recetas/favoritas.html", method = RequestMethod.GET)
      public ModelAndView returnRecipeToFavorite(HttpServletRequest request, HttpServletResponse response)
              throws ServletException, IOException {
          Log.info("/user/recetas/favoritas.html");
          User u = (User)request.getSession().getAttribute(loginUser);
          u = userService.getUserForMail(u);
         
        ArrayList<Recipe> rList = new ArrayList<Recipe>();
           Map<Integer, Recipe>recipesFavsMap = u.getFavoriteRecipes();
           if (recipesFavsMap!= null){
             Set<Integer> recipesIdSet = recipesFavsMap.keySet();
            Iterator<Integer> recipesIdIter = recipesIdSet.iterator();
            while(recipesIdIter.hasNext()){
              Integer i =recipesIdIter.next();
View Full Code Here

      @RequestMapping(value="/user/receta/lasRecetas.html", method = RequestMethod.GET)
      public ModelAndView userRecipe(HttpServletRequest request, HttpServletResponse response)
              throws ServletException, IOException {
          Log.info("/user/receta/lasRecetas.html");

          User u = (User)request.getSession().getAttribute(loginUser);
         
          ArrayList<Recipe> rList = null;
        ModelAndView view = null;

          if(u!=null){
           
            view = new ModelAndView("html/userRecipes");
          rList = recipeService.getRecipeForUserId(u.getUserId());            
          }else{
            rList = recipeService.getLastRecipes(5);
            view =new ModelAndView("html/mainTemplate");
          }
       
View Full Code Here

TOP

Related Classes of adios.model.User

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.