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.lrc.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 = "KSLR_RESCOMP")
38  @NamedQueries( {
39      @NamedQuery(name = "ResultComponent.getResultComponentIdsByResult", query = "SELECT rc.id FROM ResultComponent rc JOIN rc.resultValues rv WHERE rv.id = :resultValueId AND rc.type.id = :resultComponentTypeKey"),
40      @NamedQuery(name = "ResultComponent.getResultComponentIdsByResultComponentType", query = "SELECT rc.id FROM ResultComponent rc WHERE rc.type.id = :resultComponentTypeKey"),
41      @NamedQuery(name = "ResultComponent.getResultComponentType", query = "SELECT rc.type FROM ResultComponent rc WHERE rc.type.id = :resultComponentTypeKey")
42  })
43  
44  public class ResultComponent extends MetaEntity implements AttributeOwner<ResultComponentAttribute> {
45      private static final long serialVersionUID = 1L;
46  
47      @Column(name = "NAME")
48      private String name;
49  
50      @ManyToOne(cascade = CascadeType.ALL)
51      @JoinColumn(name = "RT_DESCR_ID")
52      private LrcRichText descr;
53  
54      @OneToMany(cascade = CascadeType.ALL, mappedBy = "resultComponent")
55      private List<ResultValue> resultValues;
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      @OneToMany(cascade = CascadeType.ALL, mappedBy = "owner")
66      private List<ResultComponentAttribute> attributes;
67  
68      @ManyToOne
69      @JoinColumn(name = "TYPE")
70      private ResultComponentType type;
71  
72      @Column(name = "STATE")
73      private String state;
74  
75      /**
76       * @return the name
77       */
78      public String getName() {
79          return name;
80      }
81  
82      /**
83       * @param name the name to set
84       */
85      public void setName(String name) {
86          this.name = name;
87      }
88  
89      /**
90       * @return the descr
91       */
92      public LrcRichText getDescr() {
93          return descr;
94      }
95  
96      /**
97       * @param descr the descr to set
98       */
99      public void setDescr(LrcRichText descr) {
100         this.descr = descr;
101     }
102 
103     /**
104      * @return the resultValues
105      */
106     public List<ResultValue> getResultValues() {
107         return resultValues;
108     }
109 
110     /**
111      * @param resultValues the resultValues to set
112      */
113     public void setResultValues(List<ResultValue> resultValues) {
114         this.resultValues = resultValues;
115     }
116 
117     /**
118      * @return the effectiveDate
119      */
120     public Date getEffectiveDate() {
121         return effectiveDate;
122     }
123 
124     /**
125      * @param effectiveDate the effectiveDate to set
126      */
127     public void setEffectiveDate(Date effectiveDate) {
128         this.effectiveDate = effectiveDate;
129     }
130 
131     /**
132      * @return the expirationDate
133      */
134     public Date getExpirationDate() {
135         return expirationDate;
136     }
137 
138     /**
139      * @param expirationDate the expirationDate to set
140      */
141     public void setExpirationDate(Date expirationDate) {
142         this.expirationDate = expirationDate;
143     }
144 
145     /**
146      * @return the type
147      */
148     public ResultComponentType getType() {
149         return type;
150     }
151 
152     /**
153      * @param type the type to set
154      */
155     public void setType(ResultComponentType type) {
156         this.type = type;
157     }
158 
159     /**
160      * @return the state
161      */
162     public String getState() {
163         return state;
164     }
165 
166     /**
167      * @param state the state to set
168      */
169     public void setState(String state) {
170         this.state = state;
171     }
172 
173     @Override
174     public List<ResultComponentAttribute> getAttributes() {
175         return attributes;
176     }
177 
178     @Override
179     public void setAttributes(List<ResultComponentAttribute> attributes) {
180         this.attributes = attributes;
181     }
182 
183 }