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.statement.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.common.entity.AttributeOwner;
34  import org.kuali.student.common.entity.MetaEntity;
35  
36  @Entity
37  @Table(name = "KSST_REF_STMT_REL")
38  @NamedQueries( {
39      @NamedQuery(name = "RefStatementRelation.getRefStatementRelations", query = "SELECT r FROM RefStatementRelation r WHERE r.refObjectTypeKey = :refObjectTypeKey and r.refObjectId = :refObjectId")
40  })
41  public class RefStatementRelation extends MetaEntity implements AttributeOwner<RefStatementRelationAttribute> {
42  
43      @Temporal(TemporalType.TIMESTAMP)
44      @Column(name = "EFF_DT")
45      private Date effectiveDate;
46  
47      @Temporal(TemporalType.TIMESTAMP)
48      @Column(name = "EXPIR_DT")
49      private Date expirationDate;    
50  
51      @Column(name="REF_OBJ_TYPE_KEY")
52  	private String refObjectTypeKey;
53  
54      @Column(name="REF_OBJ_ID")
55  	private String refObjectId;
56  
57      @ManyToOne()
58      @JoinColumn(name = "REF_STMT_REL_TYPE_ID")
59      private RefStatementRelationType refStatementRelationType;
60      
61      @Column(name="ST")
62      private String state;
63  
64  	@ManyToOne()
65      @JoinColumn(name = "STMT_ID")
66      private Statement statement;
67  
68      @OneToMany(cascade = CascadeType.ALL)
69      @JoinColumn(name = "OWNER")
70      private List<RefStatementRelationAttribute> attributes;
71  
72  	public RefStatementRelationType getRefStatementRelationType() {
73  		return refStatementRelationType;
74  	}
75  
76  	public void setRefStatementRelationType(RefStatementRelationType refStatementRelationType) {
77  		this.refStatementRelationType = refStatementRelationType;
78  	}
79  
80  	public Statement getStatement() {
81  		return statement;
82  	}
83  
84  	public void setStatement(Statement statement) {
85  		this.statement = statement;
86  	}
87  
88  	@Override
89  	public List<RefStatementRelationAttribute> getAttributes() {
90  		return this.attributes;
91  	}
92  
93  	@Override
94  	public void setAttributes(List<RefStatementRelationAttribute> attributes) {
95  		this.attributes = attributes;
96  	}
97  
98  	public String getState() {
99  		return state;
100 	}
101 
102 	public void setState(String state) {
103 		this.state = state;
104 	}
105 
106 	public String getRefObjectTypeKey() {
107 		return refObjectTypeKey;
108 	}
109 
110 	public void setRefObjectTypeKey(String refObjectTypeKey) {
111 		this.refObjectTypeKey = refObjectTypeKey;
112 	}
113 
114 	public String getRefObjectId() {
115 		return refObjectId;
116 	}
117 
118 	public void setRefObjectId(String refObjectId) {
119 		this.refObjectId = refObjectId;
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 	@Override
139 	public String toString() {
140 		return "RefStatementRelation[id=" + getId() + "]";
141 	}
142 }