View Javadoc

1   package org.kuali.student.core.document.entity;
2   
3   import java.util.Date;
4   import java.util.List;
5   
6   import javax.persistence.CascadeType;
7   import javax.persistence.Column;
8   import javax.persistence.Entity;
9   import javax.persistence.JoinColumn;
10  import javax.persistence.ManyToOne;
11  import javax.persistence.NamedQueries;
12  import javax.persistence.NamedQuery;
13  import javax.persistence.OneToMany;
14  import javax.persistence.Table;
15  import javax.persistence.Temporal;
16  import javax.persistence.TemporalType;
17  
18  import org.kuali.student.core.entity.AttributeOwner;
19  import org.kuali.student.core.entity.MetaEntity;
20  
21  @Entity
22  @Table(name="KSDO_REF_DOC_RELTN")
23  @NamedQueries( {
24      @NamedQuery(name = "RefDocRelation.getRefDocRelationsByRef", 
25      		   query = "SELECT rel FROM RefDocRelation rel WHERE rel.refObjectId = :refObjectId AND rel.refObjectType.id = :refObjectTypeKey"),
26      @NamedQuery(name = "RefDocRelation.getRefDocRelationsByDoc", 
27      		   query = "SELECT rel FROM RefDocRelation rel WHERE rel.document.id = :documentId")   
28      })
29  public class RefDocRelation extends MetaEntity implements AttributeOwner<RefDocRelationAttribute>{
30  
31      @Column(name = "REF_OBJ_ID")
32      private String refObjectId;
33  
34      @ManyToOne
35      @JoinColumn(name = "DOC_ID")
36      private Document document;
37  
38      @Column(name = "TITLE")
39      private String title;
40  
41      @ManyToOne(cascade = CascadeType.ALL)
42      @JoinColumn(name = "RT_DESCR_ID")
43      private DocumentRichText descr;
44  
45      @Temporal(TemporalType.TIMESTAMP)
46      @Column(name = "EFF_DT")
47      private Date effectiveDate;
48  
49      @Temporal(TemporalType.TIMESTAMP)
50      @Column(name = "EXPIR_DT")
51      private Date expirationDate;
52  
53      @ManyToOne
54      @JoinColumn(name = "REF_OBJ_TYPE_KEY")
55      private RefObjectType refObjectType;
56      
57      @ManyToOne
58      @JoinColumn(name = "TYPE_KEY")
59      private RefDocRelationType refDocRelationType;
60  
61      @Column(name = "ST")
62      private String state;
63  
64      @OneToMany(cascade = CascadeType.ALL, mappedBy = "owner")
65      private List<RefDocRelationAttribute> attributes;
66      
67  	@Override
68  	public void setAttributes(List<RefDocRelationAttribute> attributes) {
69  		this.attributes = attributes;
70  	}
71  
72  	@Override
73  	public List<RefDocRelationAttribute> getAttributes() {
74  		return this.attributes;
75  	}
76  
77  	public String getRefObjectId() {
78  		return refObjectId;
79  	}
80  
81  	public void setRefObjectId(String refObjectId) {
82  		this.refObjectId = refObjectId;
83  	}
84  
85  	public Document getDocument() {
86  		return document;
87  	}
88  
89  	public void setDocument(Document document) {
90  		this.document = document;
91  	}
92  
93  	public String getTitle() {
94  		return title;
95  	}
96  
97  	public void setTitle(String title) {
98  		this.title = title;
99  	}
100 
101 	public DocumentRichText getDescr() {
102 		return descr;
103 	}
104 
105 	public void setDescr(DocumentRichText descr) {
106 		this.descr = descr;
107 	}
108 
109 	public Date getEffectiveDate() {
110 		return effectiveDate;
111 	}
112 
113 	public void setEffectiveDate(Date effectiveDate) {
114 		this.effectiveDate = effectiveDate;
115 	}
116 
117 	public Date getExpirationDate() {
118 		return expirationDate;
119 	}
120 
121 	public void setExpirationDate(Date expirationDate) {
122 		this.expirationDate = expirationDate;
123 	}
124 
125 	public RefDocRelationType getRefDocRelationType() {
126 		return refDocRelationType;
127 	}
128 
129 	public void setRefDocRelationType(RefDocRelationType refDocRelationType) {
130 		this.refDocRelationType = refDocRelationType;
131 	}
132 
133 	public String getState() {
134 		return state;
135 	}
136 
137 	public void setState(String state) {
138 		this.state = state;
139 	}
140 
141 	public void setRefObjectType(RefObjectType refObjectType) {
142 		this.refObjectType = refObjectType;
143 	}
144 
145 	public RefObjectType getRefObjectType() {
146 		return refObjectType;
147 	}
148 }