1:/*
   2: * ShowRooms.java
   3: *
   4: * Created on April 3, 2006, 1:40 PM
   5: *
   6: * To change this template, choose Tools | Template Manager
   7: * and open the template in the editor.
   8: */
   9:
  10:package hotelReservations;
  11:
  12:import javax.faces.context.FacesContext;
  13:import hotelReservations.domain.Room;
  14:import java.util.List;
  15:
  16:/**
  17: *
  18: * @author AK4353
  19: */
  20:public class ShowRooms {
  21:    
  22:    /** Creates a new instance of ShowRooms */
  23:    public ShowRooms() {
  24:    }
  25:    
  26:    
  27:    /**
  28:     * Holds value of property hotelReservation.
  29:     */
  30:    private HotelManager manager;
  31:    
  32:    /**
  33:     * Setter for property hotelManager.
  34:     * @param hotelManager New value of property hotelManager.
  35:     */
  36:    public void setManager(HotelManager manager) {
  37:        this.manager = manager;
  38:    }
  39:    
  40:    public HotelManager getManager() {
  41:        return manager;
  42:    }
  43:    
  44:    /**
  45:     * Returns List of all hotel rooms objects.
  46:     */
  47:    public List getRooms() {
  48:        return this.getManager().getRooms();
  49:        
  50:    }
  51:    
  52:    
  53:    //Get current room object.
  54:    private Room getCurrentRoom() {
  55:        return (Room) FacesContext.getCurrentInstance().getExternalContext().getRequestMap().get("rowRoom");
  56:    }
  57:    //Get translated room type.
  58:    public String getDisplayedRoomType() {
  59:        return getCurrentRoom().getRoomType().equals(new Character('S')) ? "Single" : "Double";
  60:    }
  61:    //Get translated reserve status.
  62:    public String getDisplayedReserveStatus() {
  63:        return getCurrentRoom().getReserveStatus().equals(new Character('V')) ? "Vacant" : "Occupied";
  64:    }
  65:    //Get translated can smoke.
  66:    public String getDisplayedCanSmoke() {
  67:        return getCurrentRoom().getCanSmoke().equals(new Boolean(true)) ? "Yes" : "No";
  68:    }
  69:    
  70:
  71:}