Exemplo n.º 1
0
 public String addRequest(RequestVO request) throws SeeWorldException {
   String senderId = request.getSender_id();
   String recieverId = request.getReciever_id();
   if (senderId.equals(recieverId)) {
     return SELF;
   }
   params.clear();
   params.put(IRequestDAO.RECEIVER, recieverId);
   params.put(IRequestDAO.SENDER, senderId);
   if (requestDao.getCount(params) > 0) {
     return S_REQUEST;
   }
   params.clear();
   params.put(IRequestDAO.SENDER, recieverId);
   params.put(IRequestDAO.RECEIVER, senderId);
   if (requestDao.getCount(params) > 0) {
     return R_REQUEST;
   }
   if (friendLogic.areFriends(new FriendVO(recieverId, senderId))) {
     return FRIEND;
   }
   Request instance = new Request();
   User reciever = userDao.findById(recieverId);
   User sender = userDao.findById(senderId);
   instance.setSender(sender);
   instance.setReciever(reciever);
   requestDao.save(instance);
   RequestVO requestVo = new RequestVO(instance);
   requestJson = JSONObject.fromObject(requestVo);
   return SUCCESS;
 }
Exemplo n.º 2
0
 public int getRequestNum(RequestVO request) throws SeeWorldException {
   String reciever_id = request.getReciever_id();
   params.clear();
   params.put(IRequestDAO.RECEIVER, reciever_id);
   requestSum = requestDao.getCount(params);
   return requestSum;
 }
Exemplo n.º 3
0
 public void showRequestList(RequestVO request) throws SeeWorldException {
   String reciever_id = request.getReciever_id();
   User reciever = userDao.findById(reciever_id);
   List<Request> list =
       requestDao.findByProperty(
           "from Request as model where model.reciever=? order by model.addTime desc", reciever);
   requestSum = list.size();
   if (requestSum > 0) {
     requestList = new JSONArray();
     requestList.addAll(vOPOTransformator.transferRequestToVOList(list));
   }
 }
Exemplo n.º 4
0
 public void gotoPage(RequestVO request, Integer requestSum, Integer currentPage)
     throws SeeWorldException {
   String reciever_id = request.getReciever_id();
   Pagination pager = new Pagination();
   pager.setLen(requestSum);
   pager.setPagesize(settingLogic.getIntConfigValue(Constant.REQUESTS_PER_PAGE));
   pager.setCurrentpage(currentPage);
   pager.setPagelist();
   String hql =
       "from Request as model where model.reciever='"
           + reciever_id
           + "' order by model.addTime desc";
   List<Request> allRequest = requestDao.getListByPage(hql, pager.getStart(), pager.getPagesize());
   requestList = new JSONArray();
   requestList.addAll(vOPOTransformator.transferRequestToVOList(allRequest));
   PageJson = JSONObject.fromObject(pager);
 }
Exemplo n.º 5
0
 public String deleteRequest(RequestVO request) throws SeeWorldException {
   Request instance = requestDao.findById(request.getId());
   requestDao.delete(instance);
   return SUCCESS;
 }