1   
2   
3   
4   
5   
6   
7   
8   
9   
10  
11  
12  
13  
14  
15  
16  package org.kuali.mobility.library.entity;
17  
18  import java.util.Date;
19  
20  import javax.persistence.Column;
21  import javax.persistence.Entity;
22  import javax.persistence.GeneratedValue;
23  import javax.persistence.GenerationType;
24  import javax.persistence.Id;
25  import javax.persistence.JoinColumn;
26  import javax.persistence.ManyToOne;
27  import javax.persistence.Table;
28  import javax.persistence.Transient;
29  
30  
31  
32  
33  
34  
35  @Entity
36  @Table(name="LIBRARY_HOUR")
37  public class LibraryHour {
38  	
39  	public static final int DAY_MONDAY 			= 1;
40  	public static final int DAY_TUESDAY 		= 2;
41  	public static final int DAY_WEDNESDAY		= 3;
42  	public static final int DAY_THURSDAY 		= 4;
43  	public static final int DAY_FRIDAY 			= 5;
44  	public static final int DAY_SATURDAY		= 6;
45  	public static final int DAY_SUNDAY			= 7;
46  	public static final int DAY_PUBLIC_HOLIDAY	= 8;
47  
48  	
49  	@Id
50  	@GeneratedValue(strategy = GenerationType.TABLE)
51  	@Column(name="ID")
52  	private long id;
53  
54  	
55  
56  
57  
58  
59  	@Column(name="DAY_OF_WEEK")
60  	private int dayOfWeek ;
61  
62  	
63  
64  
65  	@Column(name="FROM_TIME")
66  	private Date fromTime;
67  
68  	
69  
70  
71  	@Column(name="TO_TIME")
72  	private Date toTime;
73  
74  	
75  
76  
77  	@ManyToOne(optional=false) 
78  	@JoinColumn(name="HOUR_SET_ID", nullable=false, updatable=false)
79  	private LibraryHourSet libraryHourSet;
80  	
81  	
82  
83  
84  
85  	@Transient
86  	private transient String displayLabel;
87  
88  	
89  	
90  	
91  
92  
93  
94  	public long getId() {
95  		return id;
96  	}
97  
98  	
99  
100 
101 
102 	public void setId(long id) {
103 		this.id = id;
104 	}
105 
106 	
107 
108 
109 
110 	public int getDayOfWeek() {
111 		return dayOfWeek;
112 	}
113 
114 	
115 
116 
117 
118 	public void setDayOfWeek(int dayOfWeek) {
119 		this.dayOfWeek = dayOfWeek;
120 	}
121 
122 	
123 
124 
125 
126 	public Date getFromTime() {
127 		return fromTime;
128 	}
129 
130 	
131 
132 
133 
134 	public void setFromTime(Date fromTime) {
135 		this.fromTime = fromTime;
136 	}
137 
138 	
139 
140 
141 
142 	public Date getToTime() {
143 		return toTime;
144 	}
145 
146 	
147 
148 
149 
150 	public void setToTime(Date toTime) {
151 		this.toTime = toTime;
152 	}
153 
154 	
155 
156 
157 
158 	public LibraryHourSet getLibraryHourSet() {
159 		return libraryHourSet;
160 	}
161 
162 	
163 
164 
165 
166 	public void setLibraryHourSet(LibraryHourSet libraryHourSet) {
167 		this.libraryHourSet = libraryHourSet;
168 	}
169 
170 	
171 
172 
173 
174 	public String getDisplayLabel() {
175 		return displayLabel;
176 	}
177 
178 	
179 
180 
181 
182 	public void setDisplayLabel(String displayLabel) {
183 		this.displayLabel = displayLabel;
184 	}
185 
186 	
187 
188 
189 
190 	public boolean isClosed(){
191 		return this.toTime == null || this.fromTime == null;
192 	}
193 
194 	
195 }