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.common.entity.AttributeOwner; |
19 | |
import org.kuali.student.common.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 | 9 | 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 | 3 | this.attributes = attributes; |
70 | 3 | } |
71 | |
|
72 | |
@Override |
73 | |
public List<RefDocRelationAttribute> getAttributes() { |
74 | 11 | return this.attributes; |
75 | |
} |
76 | |
|
77 | |
public String getRefObjectId() { |
78 | 5 | return refObjectId; |
79 | |
} |
80 | |
|
81 | |
public void setRefObjectId(String refObjectId) { |
82 | 2 | this.refObjectId = refObjectId; |
83 | 2 | } |
84 | |
|
85 | |
public Document getDocument() { |
86 | 5 | return document; |
87 | |
} |
88 | |
|
89 | |
public void setDocument(Document document) { |
90 | 2 | this.document = document; |
91 | 2 | } |
92 | |
|
93 | |
public String getTitle() { |
94 | 5 | return title; |
95 | |
} |
96 | |
|
97 | |
public void setTitle(String title) { |
98 | 2 | this.title = title; |
99 | 2 | } |
100 | |
|
101 | |
public DocumentRichText getDescr() { |
102 | 5 | return descr; |
103 | |
} |
104 | |
|
105 | |
public void setDescr(DocumentRichText descr) { |
106 | 2 | this.descr = descr; |
107 | 2 | } |
108 | |
|
109 | |
public Date getEffectiveDate() { |
110 | 5 | return effectiveDate; |
111 | |
} |
112 | |
|
113 | |
public void setEffectiveDate(Date effectiveDate) { |
114 | 2 | this.effectiveDate = effectiveDate; |
115 | 2 | } |
116 | |
|
117 | |
public Date getExpirationDate() { |
118 | 5 | return expirationDate; |
119 | |
} |
120 | |
|
121 | |
public void setExpirationDate(Date expirationDate) { |
122 | 2 | this.expirationDate = expirationDate; |
123 | 2 | } |
124 | |
|
125 | |
public RefDocRelationType getRefDocRelationType() { |
126 | 5 | return refDocRelationType; |
127 | |
} |
128 | |
|
129 | |
public void setRefDocRelationType(RefDocRelationType refDocRelationType) { |
130 | 2 | this.refDocRelationType = refDocRelationType; |
131 | 2 | } |
132 | |
|
133 | |
public String getState() { |
134 | 5 | return state; |
135 | |
} |
136 | |
|
137 | |
public void setState(String state) { |
138 | 2 | this.state = state; |
139 | 2 | } |
140 | |
|
141 | |
public void setRefObjectType(RefObjectType refObjectType) { |
142 | 2 | this.refObjectType = refObjectType; |
143 | 2 | } |
144 | |
|
145 | |
public RefObjectType getRefObjectType() { |
146 | 5 | return refObjectType; |
147 | |
} |
148 | |
} |