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.bo;
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.ManyToOne;
27  import javax.persistence.NamedQueries;
28  import javax.persistence.NamedQuery;
29  import javax.persistence.OneToMany;
30  import javax.persistence.Table;
31  import javax.persistence.Temporal;
32  import javax.persistence.TemporalType;
33  
34  import org.kuali.student.core.bo.KsTypeStateBusinessObjectBase;
35  
36  @Entity
37  @Table(name = "KSAP_ATP")
38  @NamedQueries( { 
39  	@NamedQuery(name = "Atp.findAtpsByAtpType", query = "SELECT atp FROM Atp atp WHERE atp.type.id = :atpTypeId"),
40  	@NamedQuery(name = "Atp.findAtpsByDate", query = "SELECT atp FROM Atp atp WHERE atp.effectiveDate <= :searchDate AND atp.expirationDate > :searchDate"),
41  	@NamedQuery(name = "Atp.findAtpsByDates", query = "SELECT atp FROM Atp atp WHERE atp.effectiveDate >= :startDate AND atp.expirationDate <= :endDate")
42  })
43  public class Atp extends KsTypeStateBusinessObjectBase {
44  	private static final long serialVersionUID = -4021959685737332345L;
45  	
46  	@ManyToOne
47  	@JoinColumn(name = "TYPE")
48  	private AtpType type;
49  
50  	@Temporal(TemporalType.TIMESTAMP)
51      @Column(name="START_DT")
52      private Date startDate;
53      
54      @Temporal(TemporalType.TIMESTAMP)
55      @Column(name="END_DT")
56      private Date endDate;
57      
58      private String descriptionId;
59      
60      private AtpRichText description;
61      
62  	@OneToMany(mappedBy = "atp", cascade = CascadeType.REMOVE)
63  	private List<DateRange> dateRanges;
64  
65  	@OneToMany(mappedBy = "atp", cascade = CascadeType.REMOVE)
66  	private List<Milestone> milestones;
67  	
68  	public Atp() {
69  		super();
70  		dateRanges = new ArrayList<DateRange>();
71  		milestones = new ArrayList<Milestone>();
72  		
73  	}
74  
75  
76      public AtpType getType() {
77  		return type;
78  	}
79  
80  	public void setType(AtpType type) {
81  		this.type = type;
82  	}
83  
84  	public Date getStartDate() {
85          return startDate;
86      }
87  
88      public void setStartDate(Date startDate) {
89          this.startDate = startDate;
90      }
91  
92      public Date getEndDate() {
93          return endDate;
94      }
95  
96      public void setEndDate(Date endDate) {
97          this.endDate = endDate;
98      }
99      
100     public String getDescriptionId() {
101         return descriptionId;
102     }
103 
104     public void setDescriptionId(String descriptionId) {
105         this.descriptionId = descriptionId;
106     }
107 
108     public AtpRichText getDescription() {
109         return description;
110     }
111 
112     public void setDescription(AtpRichText description) {
113         this.description = description;
114     }
115     
116 	public List<DateRange> getDateRanges() {
117 		return dateRanges;
118 	}
119 
120 	public void setDateRanges(List<DateRange> dateRanges) {
121 		this.dateRanges = dateRanges;
122 	}
123 
124 	public List<Milestone> getMilestones() {
125 		return milestones;
126 	}
127 
128 	public void setMilestones(List<Milestone> milestones) {
129 		this.milestones = milestones;
130 	}
131 
132 }