View Javadoc

1   /**
2    * Copyright 2010 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.student.lum.lu.entity;
17  
18  import java.util.ArrayList;
19  import java.util.Date;
20  import java.util.List;
21  
22  import javax.persistence.CascadeType;
23  import javax.persistence.Column;
24  import javax.persistence.Entity;
25  import javax.persistence.JoinColumn;
26  import javax.persistence.JoinTable;
27  import javax.persistence.ManyToMany;
28  import javax.persistence.ManyToOne;
29  import javax.persistence.NamedQueries;
30  import javax.persistence.NamedQuery;
31  import javax.persistence.OneToMany;
32  import javax.persistence.OneToOne;
33  import javax.persistence.Table;
34  import javax.persistence.Temporal;
35  import javax.persistence.TemporalType;
36  
37  import org.kuali.student.common.entity.AttributeOwner;
38  import org.kuali.student.common.entity.MetaEntity;
39  
40  @Entity
41  @Table(name = "KSLU_CLU_SET")
42  @NamedQueries( {
43  	@NamedQuery(name = "CluSet.getCluSetInfoByIdList", query = "SELECT c FROM CluSet c WHERE c.id IN (:cluSetIdList)"),
44  	@NamedQuery(name = "CluSet.isCluInCluSet", query = "SELECT COUNT(cluSet) FROM CluSet cluSet JOIN cluSet.cluVerIndIds cluVerIndIds WHERE cluSet.id = :cluSetId AND cluVerIndIds.cluVersionIndId = :cluId "),
45  	@NamedQuery(name = "CluSet.findCluSetsByCluVersionIndIds", query = "SELECT j.cluSet FROM CluSetJoinVersionIndClu j WHERE j.cluVersionIndId IN (:cluVersionIndIds)"),
46  	@NamedQuery(name = "CluSet.findAllDynamicCluSets", query = "SELECT cluSet FROM CluSet cluSet WHERE cluSet.membershipQuery IS NULL")
47  })
48  public class CluSet extends MetaEntity implements AttributeOwner<CluSetAttribute> {
49  
50  	@Column(name = "NAME")
51  	private String name;
52  
53  	@ManyToOne(cascade=CascadeType.ALL)
54  	@JoinColumn(name = "RT_DESCR_ID")
55  	private LuRichText descr;
56  
57  	@Temporal(TemporalType.TIMESTAMP)
58  	@Column(name = "EFF_DT")
59  	private Date effectiveDate;
60  
61  	@Temporal(TemporalType.TIMESTAMP)
62  	@Column(name = "EXPIR_DT")
63  	private Date expirationDate;
64  
65  	@ManyToMany
66  	@JoinTable(name = "KSLU_CLU_SET_JN_CLU_SET", joinColumns = @JoinColumn(name = "CLU_SET_PARENT_ID"), inverseJoinColumns = @JoinColumn(name = "CLU_SET_CHILD_ID"))
67  	private List<CluSet> cluSets = new ArrayList<CluSet>();
68  
69  //	@ManyToMany
70  //	@JoinTable(name = "KSLU_CLU_SET_JN_CLU", joinColumns = @JoinColumn(name = "CLU_SET_ID"), inverseJoinColumns = @JoinColumn(name = "CLU_ID"))
71  //	private List<Clu> clus = new ArrayList<Clu>();
72  	
73  	@OneToMany(mappedBy="cluSet",cascade=CascadeType.ALL)
74  	private List<CluSetJoinVersionIndClu> cluVerIndIds = new ArrayList<CluSetJoinVersionIndClu>();
75  	
76  	@OneToMany(cascade = CascadeType.ALL, mappedBy = "owner")
77  	private List<CluSetAttribute> attributes = new ArrayList<CluSetAttribute>();
78  
79  	@Column(name="TYPE")
80  	private String type;
81  
82  	@Column(name = "ST")
83      private String state;
84  
85  	@Column(name = "ADMIN_ORG_ID")
86  	private String adminOrg;
87  
88      @OneToOne(cascade=CascadeType.ALL)
89  	@JoinColumn(name="MEM_QUERY_ID")
90  	private MembershipQuery membershipQuery;
91  
92      @Column(name = "REUSABLE")
93      private Boolean isReusable;
94  
95      @Column(name = "REFERENCEABLE")
96      private Boolean isReferenceable;
97  
98  //	public List<Clu> getClus() {
99  //		return clus;
100 //	}
101 //
102 //	public void setClus(List<Clu> clus) {
103 //		this.clus = clus;
104 //	}
105 
106 	public String getName() {
107 		return name;
108 	}
109 
110 	public void setName(String name) {
111 		this.name = name;
112 	}
113 
114 	public LuRichText getDescr() {
115 		return descr;
116 	}
117 
118 	public void setDescr(LuRichText descr) {
119 		this.descr = descr;
120 	}
121 
122 	public Date getEffectiveDate() {
123 		return effectiveDate;
124 	}
125 
126 	public void setEffectiveDate(Date effectiveDate) {
127 		this.effectiveDate = effectiveDate;
128 	}
129 
130 	public Date getExpirationDate() {
131 		return expirationDate;
132 	}
133 
134 	public void setExpirationDate(Date expirationDate) {
135 		this.expirationDate = expirationDate;
136 	}
137 
138 	public List<CluSet> getCluSets() {
139 		return cluSets;
140 	}
141 
142 	public void setCluSets(List<CluSet> cluSets) {
143 		this.cluSets = cluSets;
144 	}
145 
146 	public List<CluSetAttribute> getAttributes() {
147 		return attributes;
148 	}
149 
150 	public void setAttributes(List<CluSetAttribute> attributes) {
151 		this.attributes = attributes;
152 	}
153 
154 	public String getType() {
155 		return type;
156 	}
157 
158 	public void setType(String type) {
159 		this.type = type;
160 	}
161 
162 	public String getState() {
163 		return state;
164 	}
165 
166 	public void setState(String state) {
167 		this.state = state;
168 	}
169 
170 	public String getAdminOrg() {
171 		return adminOrg;
172 	}
173 
174 	public void setAdminOrg(String adminOrg) {
175 		this.adminOrg = adminOrg;
176 	}
177 
178 	public MembershipQuery getMembershipQuery() {
179 		return membershipQuery;
180 	}
181 
182 	public void setMembershipQuery(MembershipQuery membershipQuery) {
183 		this.membershipQuery = membershipQuery;
184 	}
185 
186     public Boolean getIsReusable() {
187         return isReusable;
188     }
189 
190     public void setIsReusable(Boolean isReusable) {
191         this.isReusable = isReusable;
192     }
193 
194 	public Boolean getIsReferenceable() {
195 		return isReferenceable;
196 	}
197 
198 	public void setIsReferenceable(Boolean isReferenceable) {
199 		this.isReferenceable = isReferenceable;
200 	}
201 
202 	public List<CluSetJoinVersionIndClu> getCluVerIndIds() {
203 		return cluVerIndIds;
204 	}
205 
206 	public void setCluVerIndIds(List<CluSetJoinVersionIndClu> cluVerIndIds) {
207 		this.cluVerIndIds = cluVerIndIds;
208 	}
209 
210 }