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.core.atp.entity;
17  
18  import java.util.Date;
19  import java.util.List;
20  
21  import javax.persistence.CascadeType;
22  import javax.persistence.Column;
23  import javax.persistence.Entity;
24  import javax.persistence.JoinColumn;
25  import javax.persistence.ManyToOne;
26  import javax.persistence.NamedQueries;
27  import javax.persistence.NamedQuery;
28  import javax.persistence.OneToMany;
29  import javax.persistence.Table;
30  import javax.persistence.Temporal;
31  import javax.persistence.TemporalType;
32  
33  import org.kuali.student.core.entity.AttributeOwner;
34  import org.kuali.student.core.entity.MetaEntity;
35  
36  @Entity
37  @Table(name = "KSAP_MLSTN")
38  @NamedQueries( { 
39  	@NamedQuery(name = "Milestone.findMilestonesByAtp", query = "SELECT milestone FROM Milestone milestone WHERE milestone.atp.id = :atpId"),
40  	@NamedQuery(name = "Milestone.findMilestonesByDates", query = "SELECT milestone FROM Milestone milestone WHERE milestone.milestoneDate >= :startDate AND milestone.milestoneDate <= :endDate"),
41  	@NamedQuery(name = "Milestone.findMilestonesByDatesAndType", query = "SELECT milestone FROM Milestone milestone WHERE milestone.type.id = :milestoneTypeId AND milestone.milestoneDate >= :startDate AND milestone.milestoneDate <= :endDate")
42  })
43  public class Milestone extends MetaEntity implements
44  		AttributeOwner<MilestoneAttribute> {
45  	
46  	@Column(name = "NAME")
47  	private String name;
48  	
49  	@ManyToOne(cascade=CascadeType.ALL)
50  	@JoinColumn(name = "RT_DESCR_ID")
51  	private AtpRichText descr;
52  
53  	@ManyToOne
54  	@JoinColumn(name = "ATP_ID")
55  	private Atp atp;
56  	
57  	@Temporal(TemporalType.TIMESTAMP)
58  	@Column(name="MLSTN_DT")
59  	private Date milestoneDate;
60  	
61  	@OneToMany(cascade = CascadeType.ALL, mappedBy = "owner")
62  	private List<MilestoneAttribute> attributes;
63  
64  	@ManyToOne
65  	@JoinColumn(name = "MLSTN_TYPE_ID")
66  	private MilestoneType type;
67  	
68  	@Column(name="STATE")
69  	private String state;
70  	
71  	public String getName() {
72  		return name;
73  	}
74  
75  	public void setName(String name) {
76  		this.name = name;
77  	}
78  
79  	public Atp getAtp() {
80  		return atp;
81  	}
82  
83  	public void setAtp(Atp atp) {
84  		this.atp = atp;
85  	}
86  
87  	public Date getMilestoneDate() {
88  		return milestoneDate;
89  	}
90  
91  	public void setMilestoneDate(Date milestoneDate) {
92  		this.milestoneDate = milestoneDate;
93  	}
94  
95  	public List<MilestoneAttribute> getAttributes() {
96  		return attributes;
97  	}
98  
99  	public void setAttributes(List<MilestoneAttribute> attributes) {
100 		this.attributes = attributes;
101 	}
102 
103 	public MilestoneType getType() {
104 		return type;
105 	}
106 
107 	public void setType(MilestoneType type) {
108 		this.type = type;
109 	}
110 
111 	public String getState() {
112 		return state;
113 	}
114 
115 	public void setState(String state) {
116 		this.state = state;
117 	}
118 
119 	public void setDescr(AtpRichText descr) {
120 		this.descr = descr;
121 	}
122 
123 	public AtpRichText getDescr() {
124 		return descr;
125 	}
126 
127 }