コード例 #1
0
 // Verify user credentials
 @RequestMapping(value = "/login", method = RequestMethod.GET)
 public String login(
     @RequestParam("user") Long user, @RequestParam("pass") String pass, ModelMap model) {
   try {
     List<User> l = userDao.getByUserPass(user, pass);
     User u = l.get(0);
     Long userid = u.getId();
     String tType = u.getTenanttype();
     if (tType.contentEquals("kanban")) {
       List<Card> card = userDao.getCardsById(userid);
       model.addAttribute("userid", userid);
       model.addAttribute("tenant", tType);
       model.addAttribute("cards", card);
     } else if (tType.contentEquals("scrum")) {
       List<Story> story = userDao.getStorysById(userid);
       model.addAttribute("userid", userid);
       model.addAttribute("tenant", tType);
       model.addAttribute("story", story);
     } else if (tType.contentEquals("waterfall")) {
       List<Task> task = userDao.getTasksById(userid);
       model.addAttribute("userid", userid);
       model.addAttribute("tenant", tType);
       model.addAttribute("tasks", task);
     }
   } catch (Exception e) {
     return "Login";
   }
   return "Dashboard";
 }
コード例 #2
0
 // Get User
 @RequestMapping(value = "/get")
 @ResponseBody
 public String getById(long id) {
   String userId;
   try {
     User user = userDao.getById(id);
     userId = String.valueOf(user.getId());
   } catch (Exception ex) {
     return "User not found: " + ex.toString();
   }
   return "The user id is: " + userId;
 }
コード例 #3
0
 // Create New user
 @RequestMapping(value = "/signup", method = RequestMethod.POST)
 public String createUser(@ModelAttribute("user") User user, ModelMap model) {
   String tenant = user.getTenanttype();
   if (tenant.contentEquals("kanban")) {
     Tenant t = new Tenant("Card Name", "Card Description", "Card Type", "Assigned To");
     userDao.createUser(user, t);
   } else if (tenant.contentEquals("scrum")) {
     Tenant t =
         new Tenant(
             "Story Title", "Story Description", "Total Hours", "Remaining Hours", "Assigned To");
     userDao.createUser(user, t);
   } else if (tenant.contentEquals("waterfall")) {
     Tenant t =
         new Tenant("Task Name", "Task Description", "Start Date", "Finish Date", "Assigned To");
     userDao.createUser(user, t);
   }
   List u = userDao.getByEmail(user.getEmail());
   User us = (User) u.get(0);
   model.addAttribute("tenant", tenant);
   model.addAttribute("userId", us.getId());
   return "Project";
 }