Package it.hotel.model.facility

Examples of it.hotel.model.facility.Facility


    formController.setSuccessView(successView);
   
  }
 
  public List<Facility> getAllFacilities(){
    Facility f1 = new Facility();
    f1.setId(1);
    f1.setCode("swimming pool");
    Facility f2 = new Facility();
    f2.setId(2);
    f2.setCode("night service");
   
    List<Facility> allFacilities = new ArrayList<Facility>();
    allFacilities.add(f1);
    allFacilities.add(f2);
    return allFacilities;
View Full Code Here


    allPhotos.add(p2);
    return allPhotos;
  }
 
  public Facility getFacility(int id,String code){
    Facility f1 = new Facility();
    f1.setId(id);
    f1.setCode(code);
    return f1;
  }
View Full Code Here

    addParam("id", "1");
   
    expectUserGet(user1);
    expectToAccessUsersRole(user1, role, "SUPERUSER",true);
   
    Facility facility = getFacility(1, "pool");
    expectToGetFacility(1, facility);
    expectLocalizedObjects();
   
    replayAll();
   
    ModelAndView mav = facilityControllerDelegate.edit(req, resp);
   
    verifyAll();
 
    assertViewName(mav, "hotel.facility.new");
   
    facility = (Facility) mav.getModelMap().get("facility");
    facility.getCode();
    facility.getDescription();
 
  }
View Full Code Here

 
  @Test
  public void testFacility() throws Exception {
    Structure structure = (Structure) addStructure();
   
    Facility f = new Facility();
    f.setCode("SWIMMING");
    f.setDescription("Has a swimming pool");
    f.addStructure(structure);
    facilityRawManager.add(f);
    Facility fTest = (Facility) facilityRawManager.get(f.getId());
    Set<Structure> structures = (Set<Structure>) fTest.getStructures();
    assertEquals(1,structures.size());
    Structure sTest = structures.iterator().next();
    assertEquals(sTest.getName(),"setar");
  }
View Full Code Here

  }
 
  @Test
  public void testUpdate() throws Exception {
    Structure structure = (Structure) addHotel();
    Facility f = new Facility();
    f.setCode("SWIMMING");
    f.setDescription("Has a swimming pool");
    structure.addFacility(f);
    Facility f2 = new Facility();
    f.setCode("FOOD");
    f.setDescription("blah blahblha");
    structure.addFacility(f2);
    localizedStructureManager.add(structure);
    Structure sTest = (Structure) localizedStructureManager.get(structure.getId());
View Full Code Here

  }
 

  public void testFacility() throws Exception {
    Hotel hotel = addHotel("it");
    Facility facility = new Facility();
    facility.setCode("Swimming Pool");
    hotel.addFacility(facility);
    facility.addStructure(hotel);
    localizedHotelManager.add(hotel);
    Hotel sameHotel = (Hotel) localizedHotelManager.get(hotel.getId());
    assertEquals(1, sameHotel.getFacilities().size());
    Facility sameFacility = (Facility) sameHotel.getFacilities().iterator().next();
    assertEquals("Swimming Pool", sameFacility.getCode());
    Hotel facilityHotel = (Hotel) sameFacility.getStructures().iterator().next();
    assertEquals(hotel.getId(),facilityHotel.getId());
  }
View Full Code Here

      if (locale != null){
        localeContainer.setLocale(locale);
      }
     
      int id = Integer.parseInt(req.getParameter("id"));
      Facility facility = (Facility) facilityManager.get(id);
     
      if (locale != null){
        facility.setLocale(locale);
      }
      else{
        facility.setLocale(oldLocale);
      }
     
     
      localeContainer.setLocale(oldLocale);
      ModelAndView mav = new ModelAndView("hotel.facility.new","facility",facility);
View Full Code Here

    IUser user = userContainer.getUser();
    int hotelId = user.getStructureId();
    String[] codes = req.getParameterValues("facility");
    Structure structure = (Structure) structureManager.get(hotelId);
    Set<Facility> hotelFacilities = new HashSet<Facility>();
    Facility fac = new Facility();
   
    if (codes != null){
      for (String code : codes){
        fac.setCode(code);
        Facility facility = (Facility) facilityManager.searchByExample(fac).iterator().next();
        if (facility != null){
          hotelFacilities.add(facility);
        }
      }
    }
View Full Code Here

  private IFacilityManager facilityManager = null;
  private IUserContainer userContainer = null;
  protected ILocaleContainer localeContainer = null;
 
  protected Object formBackingObject (HttpServletRequest request) throws Exception {
    Facility facilityForm = (Facility)super.formBackingObject(request);
    return facilityForm; 

  }
View Full Code Here

 
  /**
     * @param
     */
  protected ModelAndView onSubmit (HttpServletRequest request, HttpServletResponse response, Object command, BindException errors) throws Exception{
    Facility facility = (Facility)command;
   
    String locale = (String)request.getParameter("locale");
   
    if (userContainer.getUser().getRole().hasPermission("SUPERUSER")){
     
View Full Code Here

TOP

Related Classes of it.hotel.model.facility.Facility

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.