Exemplo n.º 1
0
 @Override
 public int compare(Event e1, Event e2) {
   return ComparisonChain.start()
       .compare(e1.getUserId(), e2.getUserId())
       .compare(e1.getTimestamp(), e2.getTimestamp())
       .result();
 }
Exemplo n.º 2
0
  @RequestMapping(value = "/admin/event/updateeventform", method = RequestMethod.GET)
  public ModelAndView eventUpdateForm(
      HttpSession session,
      @RequestParam(value = "eventNum") int eventNum,
      @RequestParam(value = "pageNum") String pageNum)
      throws Exception {
    SessionInfo info = (SessionInfo) session.getAttribute("member");
    if (info == null) {
      return new ModelAndView("redirect:/member/login");
    }

    Event dto = (Event) service.readEvent(eventNum);
    if (dto == null) {
      return new ModelAndView("redirect:/event/eventlist?pageNum=" + pageNum);
    }

    if (!info.getUserId().equals(dto.getUserId())) {
      return new ModelAndView("redirct:/event/eventlist?pageNum=" + pageNum);
    }

    ModelAndView mav = new ModelAndView(".four.admin.adminevent.main");

    mav.addObject("active", "created");
    mav.addObject("eventNum", eventNum);
    mav.addObject("mode", "update");

    return mav;
  }
Exemplo n.º 3
0
  public static EventSoap toSoapModel(Event model) {
    EventSoap soapModel = new EventSoap();

    soapModel.setEventId(model.getEventId());
    soapModel.setName(model.getName());
    soapModel.setDescription(model.getDescription());
    soapModel.setDate(model.getDate());
    soapModel.setCompanyId(model.getCompanyId());
    soapModel.setGroupId(model.getGroupId());
    soapModel.setUserId(model.getUserId());
    soapModel.setCreateDate(model.getCreateDate());
    soapModel.setModifiedDate(model.getModifiedDate());
    soapModel.setLocationId(model.getLocationId());

    return soapModel;
  }
Exemplo n.º 4
0
  @RequestMapping(value = "/event/delete")
  public ModelAndView deleteEvent(
      HttpSession session,
      @RequestParam(value = "eventNum") int eventNum,
      @RequestParam(value = "pageNum") String pageNum)
      throws Exception {
    SessionInfo info = (SessionInfo) session.getAttribute("member");
    if (info == null) {
      return new ModelAndView("redirect:/member/login");
    }

    Event dto = service.readEvent(eventNum);
    if (dto == null) {
      return new ModelAndView("redirect:/event/eventlist?pageNum=" + pageNum);
    }
    if (!info.getUserId().equals(dto.getUserId()) && !info.getUserId().equals("admin")) {
      return new ModelAndView("redirect:/event/eventlist?pageNum=" + pageNum);
    }
    service.deleteEvent(eventNum);
    return new ModelAndView("redirect:/event/event");
  }