Ejemplo n.º 1
0
 private ModelAndView constructModelAndView(
     MyProfessionalProfile myProfessionalProfile, Locale locale) {
   ModelAndView modelAndView = new ModelAndView(VITEA);
   modelAndView.addObject("allWorkExperiences", constructAllWorkExperiences(locale));
   modelAndView.addObject("allEducations", constructAllEducations(locale));
   return modelAndView;
 }
 @RequestMapping("uploadError")
 public ModelAndView onUploadError(Locale locale) {
   ModelAndView modelAndView = new ModelAndView("profile/profilePage");
   modelAndView.addObject("error", messageSource.getMessage("upload.file.too.big", null, locale));
   modelAndView.addObject("profileForm", userProfileSession.toForm());
   return modelAndView;
 }
  /**
   * @param Keyword
   * @return Sorting relevancy - Answers Count - Last Replied Date - Rating - Logged In User
   *     Participated - Logged In User Connection Discussions - Logged In User Connections of
   *     connections Discussions
   */
  @RequestMapping(value = "/findquestion")
  public ModelAndView findQuestions(
      HttpServletRequest request, @RequestParam(value = "query", required = false) String Keyword) {
    ModelAndView mav = new ModelAndView();
    List<DiscussionQuestion> questions = new ArrayList<DiscussionQuestion>();

    String queryText =
        "(QuestionText:" + Keyword.toLowerCase() + "*) OR (Tags:" + Keyword.toLowerCase() + "*)";
    Object[] resultArrDiscussion = null;
    long numFoundDiscussion = 0;

    //	resultArrDiscussion = this.fetchDiscussionData(queryText,0,10);

    resultArrDiscussion = discussionQuestionClient.fetchDiscussionData(queryText, 0, 10, request);

    numFoundDiscussion = Integer.parseInt(resultArrDiscussion[1].toString());
    questions = (List<DiscussionQuestion>) resultArrDiscussion[0];

    List<DiscussionQuestion> fullQuestions = new ArrayList<DiscussionQuestion>();
    for (DiscussionQuestion question : questions) {
      if (question.getQuestionText().toLowerCase().contains(Keyword.toLowerCase()))
        fullQuestions.add(question);
    }
    // Collections.sort(questions);
    mav.addObject("TotalRecords", fullQuestions.size());
    mav.addObject("StatusOutput", "0");
    mav.addObject("Collection", fullQuestions);
    return mav;
  }
Ejemplo n.º 4
0
 /**
  * 短信邮件发送 查询用户列表集合
  *
  * @param user
  * @param page
  * @return
  */
 @RequestMapping("/user/select_userlist/{type}")
 public ModelAndView selectUserList(
     @ModelAttribute User user,
     @ModelAttribute("page") PageEntity page,
     @PathVariable("type") int type) {
   ModelAndView modelandView = new ModelAndView();
   // 设置返回页面
   modelandView.setViewName(toSelectUserList);
   try {
     if (type == 3) {
       page.setPageSize(5);
     }
     // 设置分页 ,默认每页10
     this.setPage(page);
     // 查询学员列表
     List<User> list = userService.getUserListAndCourse(user, this.getPage());
     // 把参数放到modelAndView中
     modelandView.addObject("list", list);
     modelandView.addObject("page", this.getPage());
     modelandView.addObject("type", type); // 1 短信  2邮箱  3系统消息
   } catch (Exception e) {
     logger.error("AdminUserController.userList", e);
   }
   return modelandView;
 }
  @Override
  protected ModelAndView onSubmit(
      HttpServletRequest request,
      HttpServletResponse response,
      Object command,
      BindException errors)
      throws Exception {

    SysMsgCommand msgCmd = (SysMsgCommand) command;
    log.info("SysMsgDetailController:onSubmit called.");

    NotificationDto sysMessage = msgCmd.getMsg();
    String btn = request.getParameter("btn");
    if ("delete".equalsIgnoreCase(btn)) {
      if (sysMessage.getType() == NotificationType.SYSTEM) {
        return null;
      }
      sysMessageService.removeMessage(sysMessage.getMsgId());
      ModelAndView mav = new ModelAndView("/deleteconfirm");
      mav.addObject("msg", "Location has been successfully deleted.");
      return mav;
    } else {
      if (msgCmd.getTemplateMethod() == 0) {
        MultipartFile providerScriptFile = msgCmd.getProviderScriptFile();
        String providerScriptFileName = "";
        if (providerScriptFile != null && providerScriptFile.getSize() > 0) {
          providerScriptFileName = providerScriptFile.getOriginalFilename();
          String filePath = res.getString("scriptRoot") + "/msgprovider/" + providerScriptFileName;
          File dest = new File(filePath);
          try {
            providerScriptFile.transferTo(dest);
            sysMessage.setProviderScriptName(providerScriptFileName);
            sysMessage.setMailTemplate(null);
          } catch (IllegalStateException e) {
            e.printStackTrace();
          } catch (IOException e) {
            e.printStackTrace();
          }
        }
      } else {
        MailTemplateDto mailTemplateDto =
            mailTemplateWebService
                .getTemplateById(msgCmd.getSelectedTemplateId())
                .getMailTemplate();
        sysMessage.setMailTemplate(mailTemplateDto);
        sysMessage.setProviderScriptName(null);
      }

      if (StringUtils.isEmpty(sysMessage.getMsgId())) {
        sysMessageService.addMessage(sysMessage);
      } else {
        sysMessageService.updateMessage(sysMessage);
      }
    }

    ModelAndView mav = new ModelAndView(new RedirectView(redirectView, true));
    mav.addObject("sysMsgCmd", msgCmd);

    return mav;
  }
Ejemplo n.º 6
0
  @RequestMapping("/UserDetailInfo")
  public ModelAndView userDetailInfo(HttpServletRequest request) throws Exception {
    ModelAndView mav = new ModelAndView("business/common/userDetailInfo");

    UserDto userDto = new UserDto();

    String userId = request.getParameter("userId");
    userDto = user.getUserInfo(userId);

    String userTypeName = null;
    CodeDto cdoeDto = code.getCodeInfo("SYSTEM", "USER_TYPE", userDto.getUserType());
    if (cdoeDto != null) userTypeName = cdoeDto.getCodeName();

    String birthDt = userDto.getBirthDt();
    if (!StringUtils.isEmpty(birthDt) && StringUtils.length(birthDt) == 8) {
      birthDt =
          StringUtils.substring(birthDt, 0, 2)
              + "/"
              + StringUtils.substring(birthDt, 2, 4)
              + "/"
              + StringUtils.substring(birthDt, 4);
    }
    userDto.setBirthDt(birthDt);
    userDto.setUserTypeName(userTypeName);

    mav.addObject("userPhoto", user.getProfilePhoto(userId));
    mav.addObject("userDto", userDto);

    return mav;
  }
 // See one project
 @RequestMapping(value = "viewproject", method = RequestMethod.GET)
 public ModelAndView viewproject(Integer id) throws Exception {
   ModelAndView mav = new ModelAndView();
   ProjectWrapper pw = projectDao.getProjectWrapperById(id);
   mav.addObject("pw", pw);
   Date now = new Date();
   DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
   if (!pw.getProject().getEndDate().trim().equals("")) {
     boolean expired = now.after(df.parse(pw.getProject().getEndDate()));
     mav.addObject("expired", expired);
   }
   for (RPLink r : pw.getRpLinks()) {
     if (!r.getResearcher().getEndDate().trim().equals("")) {
       if (now.after(df.parse(r.getResearcher().getEndDate()))) {
         r.getResearcher().setFullName(r.getResearcher().getFullName() + " (expired)");
       }
     }
   }
   for (APLink a : pw.getApLinks()) {
     if (a.getAdviser().getEndDate() != null && !a.getAdviser().getEndDate().trim().equals("")) {
       if (now.after(df.parse(a.getAdviser().getEndDate()))) {
         a.getAdviser().setFullName(a.getAdviser().getFullName() + " (expired)");
       }
     }
   }
   mav.addObject("jobauditBaseProjectUrl", this.jobauditBaseProjectUrl);
   return mav;
 }
Ejemplo n.º 8
0
  @RequestMapping(
      value = {"/", "/welcome**"},
      method = RequestMethod.GET)
  public ModelAndView defaultPage() {
    Authentication auth = SecurityContextHolder.getContext().getAuthentication();
    ModelAndView model = new ModelAndView();
    if (!(auth instanceof AnonymousAuthenticationToken)) {
      UserDetails userDetail = (UserDetails) auth.getPrincipal();
      model.addObject("nextBeers", nextBeerDAO.getBeers(userDetail.getUsername()));
      model.addObject(
          "hasBeersWithoutDate", nextBeerDAO.hasBeersWithoutDate(userDetail.getUsername()));
      model.setViewName("homeLogged");
    } else {
      model.setViewName("home");
    }
    NextBeer nextestBeer = nextBeerDAO.getNextBeer();
    Calendar today = Calendar.getInstance();
    today.set(Calendar.HOUR_OF_DAY, 23);
    today.set(Calendar.MINUTE, 59);
    if (nextestBeer != null && today.before(nextestBeer.getDateToPay())) {
      model.addObject("dateToPayNextBeers", nextestBeer.getDateToPay());
    }
    model.addObject("allNextBeers", nextBeerDAO.getAllNextBeers());

    return model;
  }
  /**
   * Request method to show all purchases
   *
   * @param page number of purchases page
   * @param unverified request unverified
   * @param uncompleted request uncompleted
   * @return view
   */
  @RequestMapping(value = "/purchases", method = RequestMethod.GET)
  public ModelAndView purchasesGet(
      @RequestParam(defaultValue = "1") int page,
      @RequestParam(defaultValue = "false") boolean unverified,
      @RequestParam(defaultValue = "false") boolean uncompleted) {
    ModelAndView view = new AdminModelAndView("purchases");
    if (unverified) {
      view.addObject("purchases", purchaseService.getUnverified());
      return view;
    }

    if (uncompleted) {
      view.addObject("purchases", purchaseService.getUncompleted());
      return view;
    }

    int pageCount = purchaseService.getPurchasesCount();
    if (page < 1 || page > pageCount) {
      page = 1;
    }
    List<Purchase> listPurchases = purchaseService.getPurchasesInRange(page);
    view.addObject("purchases", listPurchases);
    view.addObject("pageCount", pageCount);
    view.addObject("page", page);

    return view;
  }
Ejemplo n.º 10
0
 private void addJsonAnnotations(ModelAndView mav, String style, boolean prefix) {
   if (prefix) {
     mav.addObject("mapPrefix", "map");
     mav.addObject("mimetype", "application/x-javascript");
   } else {
     mav.addObject("mimetype", "application/json");
   }
   List<ConceptAnnotation> annotations =
       (List<ConceptAnnotation>) mav.getModel().get("annotations");
   if (annotations != null) {
     JSONArray mappings = new JSONArray();
     for (ConceptAnnotation annotation : annotations) {
       JSONObject mapping = new JSONObject();
       mapping.accumulate("id", String.valueOf(annotation.getOid()));
       mapping.accumulate("start", String.valueOf(annotation.getBegin()));
       mapping.accumulate("end", String.valueOf(annotation.getEnd()));
       mapping.accumulate("pname", annotation.getPname());
       mapping.accumulate("group", annotation.getStygroup());
       mapping.accumulate("codes", StringUtils.replace(annotation.getStycodes(), "\"", ""));
       mapping.accumulate("text", annotation.getCoveredText());
       mappings.put(mapping);
     }
     mav.addObject(
         "stringAnnotations", "pretty".equals(style) ? mappings.toString(2) : mappings.toString());
   }
 }
Ejemplo n.º 11
0
 @RequestMapping(value = "/find.html")
 public ModelAndView find(@RequestParam(value = "q", required = false) String q) {
   ModelAndView mav = new ModelAndView();
   mav.addObject("operation", "find");
   if (StringUtils.isEmpty(q)) {
     mav.setViewName("find");
     return mav;
   }
   try {
     if (NumberUtils.isNumber(q) && StringUtils.length(q) == 7) {
       return show(Integer.valueOf(q));
     } else {
       long startTs = System.currentTimeMillis();
       List<TConcept> concepts = nodeService.findConcepts(q);
       mav.addObject("concepts", concepts);
       long endTs = System.currentTimeMillis();
       mav.addObject("q", q);
       mav.addObject("elapsed", new Long(endTs - startTs));
     }
   } catch (Exception e) {
     mav.addObject("error", e.getMessage());
   }
   mav.setViewName("find");
   return mav;
 }
Ejemplo n.º 12
0
 private void addXmlAnnotations(ModelAndView mav, String style) {
   List<ConceptAnnotation> annotations =
       (List<ConceptAnnotation>) mav.getModel().get("annotations");
   mav.addObject("mimetype", "text/xml");
   if (annotations != null) {
     Document doc = DocumentFactory.getInstance().createDocument();
     Element mappings = doc.addElement("mappings");
     for (ConceptAnnotation annotation : annotations) {
       Element mapping = mappings.addElement("mapping");
       mapping.addAttribute("id", String.valueOf(annotation.getOid()));
       mapping.addAttribute("start", String.valueOf(annotation.getBegin()));
       mapping.addAttribute("end", String.valueOf(annotation.getEnd()));
       mapping.addAttribute("pname", annotation.getPname());
       mapping.addAttribute("group", annotation.getStygroup());
       mapping.addAttribute("codes", StringUtils.replace(annotation.getStycodes(), "\"", ""));
       mapping.setText(annotation.getCoveredText());
     }
     OutputFormat outputFormat =
         "compact".equals(style)
             ? OutputFormat.createCompactFormat()
             : OutputFormat.createPrettyPrint();
     StringWriter swriter = new StringWriter();
     XMLWriter writer = new XMLWriter(swriter, outputFormat);
     try {
       writer.write(doc);
       writer.flush();
       mav.addObject("stringAnnotations", swriter.toString());
     } catch (IOException e) {
       logger.warn("IOException writing XML to buffer", e);
     }
   }
 }
Ejemplo n.º 13
0
 @RequestMapping(value = "/show.html", method = RequestMethod.GET)
 public ModelAndView show(@RequestParam(value = "q", required = true) int q) {
   ModelAndView mav = new ModelAndView();
   mav.addObject("operation", "show");
   try {
     long startTs = System.currentTimeMillis();
     // show all details about the concept
     TConcept concept = nodeService.getConcept(q);
     Bag<TRelTypes> relCounts = nodeService.getRelationCounts(concept);
     Map<String, List<TRelation>> relmap = new HashMap<String, List<TRelation>>();
     Map<Integer, String> oidmap = new HashMap<Integer, String>();
     for (TRelTypes reltype : relCounts.uniqueSet()) {
       List<TRelation> rels = nodeService.getRelatedConcepts(concept, reltype);
       for (TRelation rel : rels) {
         TConcept toConcept = nodeService.getConcept(rel.getToOid());
         oidmap.put(rel.getToOid(), toConcept.getPname());
       }
       relmap.put(reltype.name(), rels);
     }
     mav.addObject("concept", concept);
     mav.addObject("relmap", relmap);
     mav.addObject("oidmap", oidmap);
     long endTs = System.currentTimeMillis();
     mav.addObject("elapsed", new Long(endTs - startTs));
   } catch (Exception e) {
     mav.addObject("error", e.getMessage());
   }
   mav.setViewName("show");
   return mav;
 }
Ejemplo n.º 14
0
  @RequestMapping(value = "/addCustomer.htm", method = RequestMethod.POST)
  public ModelAndView addCustomer(
      @ModelAttribute("customer") @Valid Customer customer,
      BindingResult result,
      SessionStatus status) {

    ModelAndView mav = new ModelAndView();

    if (result.hasErrors()) {
      LOGGER.info("Error occurred in AddCustomer form ");
      mav.setViewName("AddCustomer");
      mav.addObject("customer", customer);
      return mav;
    } else {
      int resultValue = 0;
      resultValue = customerService.addCustomer(customer);
      if (StringUtils.isBlank(customer.getCustomerID()))
        customer.setCustomerID(Integer.toString(resultValue));

      LOGGER.info("Customer added !! ");
      mav.setViewName("AddCustomer");
      // mav.addObject("resultValue", resultValue);
      mav.addObject("customer", customer);
      return mav;
    }
  }
Ejemplo n.º 15
0
  @RequestMapping(value = "/account/groups/edit", method = RequestMethod.GET)
  public ModelAndView editGroup(
      @RequestParam String groupId,
      @RequestParam(required = false) boolean editGroup,
      @RequestParam(required = false) boolean memberAdd,
      @RequestParam(required = false) boolean memberRemove,
      @RequestParam(required = false) boolean noUser,
      @RequestParam(required = false) boolean wrongUser) {

    ModelAndView mv = basicModelAndView();
    mv.addObject("editGroup", editGroup);
    mv.addObject("memberAdd", memberAdd);
    mv.addObject("memberRemove", memberRemove);
    mv.addObject("noUser", noUser);
    mv.addObject("wrongUser", wrongUser);
    Collection<Group> groups = groupService.getGroupsWhereCurrentUserIsAdmin();
    Group group = null;
    for (Group testGroup : groups) {
      if (testGroup.getGroupId().equals(groupId)) {
        group = testGroup;
        break;
      }
    }
    if (group == null) {
      return new ModelAndView("redirect:/tatami/account/groups");
    }
    Collection<UserGroupDTO> users = groupService.getMembersForGroup(group.getGroupId());
    mv.addObject("users", users);
    mv.addObject("group", group);
    mv.setViewName("account_groups_edit");
    return mv;
  }
Ejemplo n.º 16
0
 /**
  * Request method to get form for category
  *
  * @param categoryId category to edit
  * @return view form
  */
 @RequestMapping(value = "/edit/categoryform/{categoryId}", method = RequestMethod.GET)
 public ModelAndView editCategoryForm(@PathVariable int categoryId) {
   ModelAndView view = new ModelAndView("/admin-pages/category_form");
   view.addObject("category", categoryService.getCategory(categoryId));
   view.addObject("edit", true);
   return view;
 }
 /**
  * 分页获取地区
  *
  * @return
  */
 @RequestMapping(value = "/list.htm", method = RequestMethod.POST)
 public ModelAndView listPagination(HttpServletRequest request) {
   ModelAndView modelAndView = new ModelAndView();
   modelAndView.setViewName("/area/areaData");
   // 分页处理
   Map<String, Object> params = new HashMap<String, Object>();
   Pagination p = PaginationUtil.parse(request);
   params.put("start", (p.getCurPage() - 1) * p.getPageSize() + 1);
   // mysql
   params.put("end", p.getPageSize());
   // oracle
   // params.put("end", p.getCurPage()*p.getPageSize());
   // 排序
   String sort = request.getParameter("sort"); // 状态
   String order = request.getParameter("order"); // 创建 时间
   params.put("sort", sort);
   params.put("order", order); //
   // 总数量
   int total = areaService.getAllEntityCount(params);
   p = PaginationUtil.parse(request, total);
   // 分页记录集
   List<Area> areas = areaService.getAllEntity(params);
   modelAndView.addObject("pagination", p);
   modelAndView.addObject("datas", areas);
   return modelAndView;
 }
Ejemplo n.º 18
0
 /**
  * Request method to get user form
  *
  * @param userId to edit
  * @return view
  */
 @RequestMapping(value = "/edit/userform/{userId}", method = RequestMethod.GET)
 public ModelAndView editUserForm(@PathVariable int userId) {
   ModelAndView view = new ModelAndView("/admin-pages/user_form");
   view.addObject("user", userService.getUser(userId));
   view.addObject("editUser", true);
   return view;
 }
Ejemplo n.º 19
0
  @RequestMapping("/edit_customer")
  public ModelAndView edit_customer(HttpServletRequest request) {
    int ID = Integer.parseInt(request.getParameter("userID"));

    ApplicationContext context = new ClassPathXmlApplicationContext("Spring-Module.xml");

    Map<String, String> user = new HashMap<String, String>();

    CustomerDAO customerDAO = (CustomerDAO) context.getBean("customerDAO");

    user = customerDAO.findCurrentCustomerById(ID);

    IndustryDAO industryDAO = (IndustryDAO) context.getBean("industryDAO");
    List<Industry> industries = new ArrayList<Industry>();
    industries = industryDAO.getIndustriesList();

    ModelAndView model = new ModelAndView("edit_customer");
    model.addObject("userData", user);
    model.addObject("industryList", industries);
    /**
     * <c:forEach items="${countries}" var="country"> <option
     * value="${country.key}">${country.value}</option> </c:forEach>
     */
    return model;
  }
Ejemplo n.º 20
0
 public ModelAndView summaryList(
     HttpServletRequest paramHttpServletRequest, HttpServletResponse paramHttpServletResponse)
     throws Exception {
   this.logger.debug("entering 'summaryList' method...");
   VoucherService localVoucherService = (VoucherService) SysData.getBean("f_voucherService");
   ViewService localViewService = (ViewService) SysData.getBean("f_viewService");
   List localList1 = localViewService.getTrademoduleList();
   List localList2 = localViewService.getLedgerFieldList();
   QueryConditions localQueryConditions =
       QueryHelper.getQueryConditionsFromRequest(paramHttpServletRequest);
   PageInfo localPageInfo = QueryHelper.getPageInfoFromRequest(paramHttpServletRequest);
   if (localPageInfo == null) {
     localPageInfo = new PageInfo(1, 15, "summaryNo", false);
   }
   List localList3 = localVoucherService.getSummarys(localQueryConditions, localPageInfo);
   String str = paramHttpServletRequest.getParameter("targetView");
   if (str == null) {
     str = "voucher/listSummary";
   }
   Map localMap = WebUtils.getParametersStartingWith(paramHttpServletRequest, "_");
   ModelAndView localModelAndView = new ModelAndView("finance/" + str, "resultList", localList3);
   localModelAndView.addObject("pageInfo", localPageInfo);
   localModelAndView.addObject("oldParams", localMap);
   localModelAndView.addObject("fieldList", localList2);
   localModelAndView.addObject("moduleList", localList1);
   return localModelAndView;
 }
Ejemplo n.º 21
0
 /**
  * @author zhang.jie 页面跳转-客房列表
  * @param request
  * @return 2015-9-17
  */
 @PolicyJournal(accessLevel = AccessLevel.PRIVATE)
 @RequestMapping("/to_hotelRoom_query")
 public ModelAndView to_hotel_query(HttpServletRequest request, HotelRoomBo hotelRoomBo) {
   ModelAndView mav = new ModelAndView("/hotelroom/to_hotelRoom_query");
   LoginUser user = LoginSessionUtil.getSystemSession(request);
   // 判断当前用户是否为加盟商
   String agentId = null;
   if (user.getAgentId() != null) {
     String id = user.getAgentId().toString();
     hotelRoomBo.setAgentId(id);
     agentId = user.getAgentId().toString();
   }
   String roomTypeId = request.getParameter("roomTypeId");
   if (StringUtils.isNotBlank(roomTypeId)) {
     hotelRoomBo.setId(roomTypeId);
   }
   // 未删除
   hotelRoomBo.setStatus("1");
   // 分页
   Page<List<Map<String, Object>>> page = Page.getPage(request);
   // 分页查询
   hotelRoomService.queryHotelRoomListByConditions(hotelRoomBo, page);
   List<Map<String, Object>> hotelList = hotelRoomService.selectHotelNameByagentId(agentId);
   mav.addObject("hotelList", hotelList);
   mav.addObject("page", page);
   mav.addObject("hotelRoomBo", hotelRoomBo);
   return mav;
 }
Ejemplo n.º 22
0
 public ModelAndView setVoucherBDate(
     HttpServletRequest paramHttpServletRequest, HttpServletResponse paramHttpServletResponse)
     throws Exception {
   this.logger.debug("entering 'setVoucherBDate' method...");
   VoucherService localVoucherService = (VoucherService) SysData.getBean("f_voucherService");
   String str1 = paramHttpServletRequest.getParameter("minDate");
   String str2 = paramHttpServletRequest.getParameter("b_date");
   String str3 = paramHttpServletRequest.getParameter("maxDate");
   String str4 = paramHttpServletRequest.getParameter("sign");
   String str5 = null;
   String str6 = null;
   String str7 = AclCtrl.getLogonID(paramHttpServletRequest);
   this.logger.debug("sign:" + str4);
   this.logger.debug("b_date:" + str2);
   if ("true".equals(str4)) {
     str5 = str3;
     this.logger.debug("endDate:" + str5);
   } else {
     str5 = str2;
   }
   int i = localVoucherService.setVoucherBDate(str1, str5, str7);
   if (i >= 0) {
     str6 = "设置结算日期成功!";
   } else {
     str6 = "设置结算日期失败";
   }
   ModelAndView localModelAndView =
       new ModelAndView("finance/public/doneIntoVoucher", "resultMsg", str6);
   localModelAndView.addObject("result", new Integer(i));
   localModelAndView.addObject("result1", new Integer(i));
   return localModelAndView;
 }
Ejemplo n.º 23
0
  @RequestMapping("/login")
  public ModelAndView autenticacion(
      @RequestParam("email") String email, @RequestParam("password") String password)
      throws PersistenceException {

    ModelAndView reenvio = null;

    if (loginService.validar(email, password)) {
      ModelAndView modelAndView = new ModelAndView();
      // busca un agente por el email que recibio por parametro
      Agente agente = agenteService.findByEmail(email);
      // cuenta la cantidad de noticias que tiene y guarda la cantidad en novedades
      List<Noticia> noticiasSeguidas = noticiaService.findNoticiasByEmpresaSeguida(email);
      Integer novedades = noticiasSeguidas.size();
      // guarda los datos de la sesion
      modelAndView.addObject("agente", agente);
      modelAndView.addObject("novedades", novedades);
      modelAndView.setViewName("bienvenidoagente");
      return modelAndView;
    } else {
      reenvio = new ModelAndView("index2", "mensaje", "Contraseña incorrecta, o usuario no valido");
    }

    return reenvio;
  }
Ejemplo n.º 24
0
  /** 进入保存新增系统类型组 */
  @RequestMapping(value = "/savegroup")
  public ModelAndView savegroup(
      HttpServletRequest request, HttpServletResponse response, MisTypeInfo mistype)
      throws Exception {
    String msg = "";
    ModelAndView mav = new ModelAndView();
    mav.setViewName(SUCCESS_ACTION);
    if (mistype == null) {
      this.logger.warn("保存系统类型组时传递的MisTypeInfo为null");
      msg = "failed";

    } else {
      MisTypeInfo checkMisType = mistypeService.getMisTypeInfo(mistype.getTypeId());
      if (checkMisType == null) {
        try {
          mistypeService.saveGroup(mistype);
          this.insertLog(request, "新增系统类型组");
        } catch (Exception e) {

          msg = "failed";
          e.printStackTrace();
          this.logger.error("新增系统类型组失败:" + e.getMessage(), e);
        }

      } else {
        msg = "该系统类型组Id已存在!";
      }
    }

    mav.addObject("mistype", mistype);
    mav.addObject("msg", msg);
    return mav;
  }
 @ExceptionHandler(IOException.class)
 public ModelAndView handleIOException(Locale locale) {
   ModelAndView modelAndView = new ModelAndView("profile/profilePage");
   modelAndView.addObject("error", messageSource.getMessage("upload.io.exception", null, locale));
   modelAndView.addObject("profileForm", userProfileSession.toForm());
   return modelAndView;
 }
Ejemplo n.º 26
0
 /**
  * Renders an empty form used to create a new client record.
  *
  * @return create view populated with an empty client
  */
 @RequestMapping(value = "create", method = RequestMethod.GET)
 public ModelAndView create() {
   ModelAndView mav = new ModelAndView("client/create");
   mav.addObject("client", new Client());
   mav.addObject("errors", new ArrayList<String>());
   return mav;
 }
  @RequestMapping(value = "{project}", method = RequestMethod.POST)
  public ModelAndView postHandler(
      @PathVariable("project") String projectName,
      @ModelAttribute("version") Version version,
      BindingResult result) {

    ModelAndView mav = new ModelAndView();
    mav.addObject("projectName", projectName);
    mav.setViewName("settings/versions");

    // TODO - validate (add hibernate validator)
    if (result.hasErrors()) {
      return mav;
    }

    /* success */
    //        if (pipelineService.addVersion(projectName, version.getNumber())) {
    //            mav.setViewName("redirect:/settings/versions/" + projectName);
    //            return mav;
    //        }

    // TODO - display error on the page
    mav.addObject("error", String.format("Version %s has not been added.", version.getNumber()));
    return mav;
  }
  // Common
  @RequestMapping(value = "/mail/send.do")
  public ModelAndView viewSendMail(
      @RequestParam(value = "userId", required = false) List<String> userIds,
      @RequestParam(value = "bid", defaultValue = "0") int boardCodeId) {
    ModelAndView modelAndView = new ModelAndView("/mail/send");
    List<MailView> mails = new ArrayList<MailView>();
    MailList mailList = new MailList();
    List<TeamCodeView> teamCodeList = null;

    //		한 경진대회 참가자들에게 메시지 보내기
    if (boardCodeId != 0) {
      teamCodeList = teamService.findTeamCodes(boardCodeId, null);
      for (TeamCodeView tcv : teamCodeList) {
        List<TeamView> teamList = teamService.findTeams(tcv.getTeamCodeId());
        for (TeamView tv : teamList) {
          MailView mv = mailService.getEmail(tv.getUserId(), null, null);
          if (mv != null) mails.add(mv);
        }
      }
    }
    //		선택한 참가자들에게 메시지 보내기
    if (userIds != null) {
      for (String userId : userIds) {
        MailView mv = mailService.getEmail(userId, null, null);
        if (mv != null) mails.add(mv);
      }
    }
    mailList.setMails(mails);
    modelAndView.addObject("mailList", mailList);
    modelAndView.addObject("subTitle", "메일보내기");
    modelAndView.addObject("mypageType", "send");
    return modelAndView;
  }
  @RequestMapping(value = "/getQuestionStatus")
  public ModelAndView getQuestionStatus(
      HttpServletRequest request,
      @RequestParam(value = "QuestionText", required = true, defaultValue = "abcd")
          String QuestionText) {

    ModelAndView mav = new ModelAndView();
    Object[] resultArrDiscussion = null;
    String Query = null;
    long numFoundDiscussion = 0;
    List<DiscussionQuestion> questions = new ArrayList<DiscussionQuestion>();
    QuestionText = QuestionText.replaceAll("\\s", "");

    QuestionText = Adder.escapeQueryChars(QuestionText);

    Query = "(QuestionStaus:" + QuestionText + ")";

    resultArrDiscussion =
        discussionQuestionClient.fetchQuestionStatus(
            Query, serverurlConstants.ADD_DISSCUSSION_QUESTION_URL, request);

    numFoundDiscussion = Integer.parseInt(resultArrDiscussion[1].toString());
    questions = (List<DiscussionQuestion>) resultArrDiscussion[0];

    if (questions.size() > 0) mav.addObject("Status", "Active");
    else mav.addObject("Status", "NotActive");

    return mav;
  }
Ejemplo n.º 30
0
  @RequestMapping(value = URL_PROFILE_ADDTAG, method = RequestMethod.POST)
  public ModelAndView addTag(
      @ModelAttribute(COMMAND_TAG) @Valid Tool tool, BindingResult result, Locale locale) {

    if (result.hasErrors()) {
      // basic validation fails
      ModelAndView modelAndView = constructModelAndView(tool, locale);
      modelAndView.addObject(COMMAND_TAG, tool);

      return modelAndView;
    }

    if (profileService.isKnownTag(tool.getTagName())) {

      profileService.storeTag(tool.getTagName());
      ModelAndView modelAndView = new ModelAndView(new RedirectView(URL_ACCOUNT_VITEA));

      return modelAndView;
    } else if (tool.getTagName().equals(tool.getPreviousTagName())) {
      profileService.storeTag(tool.getTagName());
      ModelAndView modelAndView = new ModelAndView(new RedirectView(URL_ACCOUNT_VITEA));

      return modelAndView;
    } else {
      List<String> alternatives = profileService.searchForTags(tool.getTagName(), locale);

      ModelAndView modelAndView = constructModelAndView(tool, locale);
      modelAndView.addObject(COMMAND_TAG, tool);
      modelAndView.addObject("alternatives", alternatives);
      tool.setPreviousTagName(tool.getTagName());

      return modelAndView;
    }
  }