View Javadoc

1   /**
2    * Copyright (C) 2005-2009 Alfresco Software Limited.
3    *
4    * This file is part of the Spring Surf Extension project.
5    *
6    * Licensed under the Apache License, Version 2.0 (the "License");
7    * you may not use this file except in compliance with the License.
8    * You may obtain a copy of the License at
9    *
10   *  http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing, software
13   * distributed under the License is distributed on an "AS IS" BASIS,
14   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15   * See the License for the specific language governing permissions and
16   * limitations under the License.
17   */
18  
19  package org.springframework.webflow.samples.booking;
20  
21  import java.io.Serializable;
22  import java.math.BigDecimal;
23  
24  import javax.persistence.Column;
25  import javax.persistence.Entity;
26  import javax.persistence.GeneratedValue;
27  import javax.persistence.Id;
28  
29  /**
30   * A hotel where users may book stays.
31   */
32  @Entity
33  public class Hotel implements Serializable {
34      private Long id;
35  
36      private String name;
37  
38      private String address;
39  
40      private String city;
41  
42      private String state;
43  
44      private String zip;
45  
46      private String country;
47  
48      private BigDecimal price;
49  
50      @Id
51      @GeneratedValue
52      public Long getId() {
53  	return id;
54      }
55  
56      public void setId(Long id) {
57  	this.id = id;
58      }
59  
60      public String getName() {
61  	return name;
62      }
63  
64      public void setName(String name) {
65  	this.name = name;
66      }
67  
68      public String getAddress() {
69  	return address;
70      }
71  
72      public void setAddress(String address) {
73  	this.address = address;
74      }
75  
76      public String getCity() {
77  	return city;
78      }
79  
80      public void setCity(String city) {
81  	this.city = city;
82      }
83  
84      public String getZip() {
85  	return zip;
86      }
87  
88      public void setZip(String zip) {
89  	this.zip = zip;
90      }
91  
92      public String getState() {
93  	return state;
94      }
95  
96      public void setState(String state) {
97  	this.state = state;
98      }
99  
100     public String getCountry() {
101 	return country;
102     }
103 
104     public void setCountry(String country) {
105 	this.country = country;
106     }
107 
108     @Column(precision = 6, scale = 2)
109     public BigDecimal getPrice() {
110 	return price;
111     }
112 
113     public void setPrice(BigDecimal price) {
114 	this.price = price;
115     }
116 
117     public Booking createBooking(User user) {
118 	return new Booking(this, user);
119     }
120 
121     @Override
122     public String toString() {
123 	return "Hotel(" + name + "," + address + "," + city + "," + zip + ")";
124     }
125 }