Пример #1
0
  private Map constructQueryMap(HotelContractQueryForm queryForm) {
    Map conditions = new HashMap();

    Integer id = ActionUtils.parseInt(queryForm.getId());
    if (id != null) {
      conditions.put(HotelContractQueryCondition.ID_EQ, id);
    }

    Integer hotel_id = ActionUtils.parseInt(queryForm.getHotel_id());
    if (hotel_id != null) {
      conditions.put(HotelContractQueryCondition.HOTEL_ID_EQ, hotel_id);
    }

    String fileName = queryForm.getFileName();
    if (fileName != null && fileName.trim().length() != 0) {
      conditions.put(HotelContractQueryCondition.FILENAME_LIKE, fileName);
    }

    String description = queryForm.getDescription();
    if (description != null && description.trim().length() != 0) {
      conditions.put(HotelContractQueryCondition.DESCRIPTION_LIKE, description);
    }

    String uploadDate = queryForm.getUploadDate();
    if (uploadDate != null && uploadDate.trim().length() != 0) {
      conditions.put(HotelContractQueryCondition.UPLOADDATE_EQ, uploadDate);
    }
    return conditions;
  }
Пример #2
0
 private Hotel getHotelFromRequest(HttpServletRequest request) throws Exception {
   Integer id = ActionUtils.parseInt(request.getParameter("hotel_id"));
   HotelManager hotelManager = ServiceLocator.getHotelManager(request);
   Hotel hotel = hotelManager.getHotel(id);
   if (hotel == null) throw new ActionException("hotel.notFound", id);
   return hotel;
 }
Пример #3
0
 private HotelContract getHotelContractFromRequest(HttpServletRequest request) throws Exception {
   Integer id = ActionUtils.parseInt(request.getParameter("id"));
   HotelContractManager hotelContractManager = ServiceLocator.getHotelContractManager(request);
   HotelContract hotelContract = hotelContractManager.getHotelContract(id);
   if (hotelContract == null) throw new ActionException("hotelContract.notFound", id);
   return hotelContract;
 }