View Javadoc

1   /**
2    * Copyright 2011-2012 The Kuali Foundation Licensed under the
3    * Educational Community License, Version 2.0 (the "License"); you may
4    * not use this file except in compliance with the License. You may
5    * obtain a copy of the License at
6    *
7    * http://www.osedu.org/licenses/ECL-2.0
8    *
9    * Unless required by applicable law or agreed to in writing,
10   * software distributed under the License is distributed on an "AS IS"
11   * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
12   * or implied. See the License for the specific language governing
13   * permissions and limitations under the License.
14   */
15  
16  package org.kuali.mobility.library.entity;
17  
18  import java.util.Date;
19  
20  import javax.persistence.CascadeType;
21  import javax.persistence.Column;
22  import javax.persistence.Entity;
23  import javax.persistence.GeneratedValue;
24  import javax.persistence.GenerationType;
25  import javax.persistence.Id;
26  import javax.persistence.JoinColumn;
27  import javax.persistence.NamedQueries;
28  import javax.persistence.NamedQuery;
29  import javax.persistence.OneToOne;
30  import javax.persistence.Table;
31  import javax.persistence.Version;
32  
33  
34  /**
35   * A class representing a Library
36   * @author Kuali Mobility Team (mobility.collab@kuali.org)
37   * @since
38   */
39  @NamedQueries({
40  	// Gets all the libraries ordered by campus code and order
41  	@NamedQuery(
42  		name="Library.getLibraries",
43  		query="SELECT a FROM Library a ORDER BY a.campusCode, a.order ASC "),
44  	// Gets all the libraries in a list of IDs
45  	@NamedQuery(
46  		name="Library.getLibrariesByIds",
47  		query="SELECT a FROM Library a where a.id IN (:libraryIds) ORDER BY a.campusCode, a.order ASC ")
48  })
49  @Entity
50  @Table(name="LIBRARY")
51  public class Library {
52  	
53  	/** Id of the Library */
54  	@Id
55  	@GeneratedValue(strategy = GenerationType.IDENTITY)
56  	@Column(name="ID")
57  	private long id;
58  	
59  	/**
60  	 * Name of the Library
61  	 */
62  	@Column(name="NAME" , nullable=false)
63  	private String name;
64  	
65  	/**
66  	 * Order of the library at a campus level list
67  	 */
68  	@Column(name="ORDR")
69  	private int order;
70  	
71  	/**
72  	 * Campus on which this library resides
73  	 */
74  	@Column(name="CAMPUS_CODE")
75  	private String campusCode;
76  	
77  	/** 
78  	 * Contact details for this library 
79  	 */
80  	@OneToOne(optional=false,cascade=CascadeType.ALL)
81  	@JoinColumn(name="LIBRARY_CONTACT_ID")
82  	private LibraryContactDetail libraryContactDetail;
83  
84  	/**
85  	 * Flag if this library is active
86  	 */
87  	@Column(name="ACTIVE")
88  	private boolean active;
89  
90  	/**
91  	 * Gets the id for this <code>Library</code>.
92  	 * @return the id
93  	 */
94  	public long getId() {
95  		return id;
96  	}
97  
98  	/**
99  	 * Sets the id for this <code>Library</code>.
100 	 * @param id the id to set
101 	 */
102 	public void setId(long id) {
103 		this.id = id;
104 	}
105 
106 	/**
107 	 * Gets the name for this <code>Library</code>.
108 	 * @return the name
109 	 */
110 	public String getName() {
111 		return name;
112 	}
113 
114 	/**
115 	 * Sets the name for this <code>Library</code>.
116 	 * @param name the name to set
117 	 */
118 	public void setName(String name) {
119 		this.name = name;
120 	}
121 
122 	/**
123 	 * Gets the order for this <code>Library</code>.
124 	 * @return the order
125 	 */
126 	public int getOrder() {
127 		return order;
128 	}
129 
130 	/**
131 	 * Sets the order for this <code>Library</code>.
132 	 * @param order the order to set
133 	 */
134 	public void setOrder(int order) {
135 		this.order = order;
136 	}
137 
138 	/**
139 	 * Gets the campusCode for this <code>Library</code>.
140 	 * @return the campusCode
141 	 */
142 	public String getCampusCode() {
143 		return campusCode;
144 	}
145 
146 	/**
147 	 * Sets the campusCode for this <code>Library</code>.
148 	 * @param campusCode the campusCode to set
149 	 */
150 	public void setCampusCode(String campusCode) {
151 		this.campusCode = campusCode;
152 	}
153 
154 	/**
155 	 * Gets the libraryContactDetail for this <code>Library</code>.
156 	 * @return the libraryContactDetail
157 	 */
158 	public LibraryContactDetail getLibraryContactDetail() {
159 		return libraryContactDetail;
160 	}
161 
162 	/**
163 	 * Sets the libraryContactDetail for this <code>Library</code>.
164 	 * @param libraryContactDetail the libraryContactDetail to set
165 	 */
166 	public void setLibraryContactDetail(LibraryContactDetail libraryContactDetail) {
167 		this.libraryContactDetail = libraryContactDetail;
168 	}
169 
170 	/**
171 	 * Gets the active for this <code>Library</code>.
172 	 * @return the active.
173 	 */
174 	public boolean isActive() {
175 		return active;
176 	}
177 
178 	/**
179 	 * Sets the active for this <code>Library</code>.
180 	 * @param active the active to set.
181 	 */
182 	public void setActive(boolean active) {
183 		this.active = active;
184 	}
185 	
186 	
187 
188 
189 }