1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
package org.kuali.student.core.document.entity; |
17 | |
|
18 | |
import java.util.Date; |
19 | |
import java.util.List; |
20 | |
|
21 | |
import javax.persistence.AttributeOverride; |
22 | |
import javax.persistence.AttributeOverrides; |
23 | |
import javax.persistence.CascadeType; |
24 | |
import javax.persistence.Column; |
25 | |
import javax.persistence.Entity; |
26 | |
import javax.persistence.FetchType; |
27 | |
import javax.persistence.JoinColumn; |
28 | |
import javax.persistence.JoinTable; |
29 | |
import javax.persistence.Lob; |
30 | |
import javax.persistence.ManyToMany; |
31 | |
import javax.persistence.ManyToOne; |
32 | |
import javax.persistence.OneToMany; |
33 | |
import javax.persistence.Table; |
34 | |
import javax.persistence.Temporal; |
35 | |
import javax.persistence.TemporalType; |
36 | |
|
37 | |
import org.kuali.student.common.entity.AttributeOwner; |
38 | |
import org.kuali.student.common.entity.MetaEntity; |
39 | |
|
40 | |
|
41 | |
|
42 | |
|
43 | |
|
44 | |
|
45 | |
@Entity |
46 | |
@Table(name = "KSDO_DOCUMENT") |
47 | |
@AttributeOverrides({ |
48 | |
@AttributeOverride(name="id", column=@Column(name="DOC_ID"))}) |
49 | 39 | public class Document extends MetaEntity implements AttributeOwner<DocumentAttribute> { |
50 | |
private static final long serialVersionUID = 1L; |
51 | |
|
52 | |
@Column(name = "NAME") |
53 | |
private String name; |
54 | |
|
55 | |
@Column(name = "FILE_NAME") |
56 | |
private String fileName; |
57 | |
|
58 | |
@ManyToOne(cascade = CascadeType.ALL) |
59 | |
@JoinColumn(name = "RT_DESCR_ID") |
60 | |
private DocumentRichText descr; |
61 | |
|
62 | |
@Lob |
63 | |
@Column(name = "DOCUMENT", length=10000000) |
64 | |
private String document; |
65 | |
|
66 | |
@Temporal(TemporalType.TIMESTAMP) |
67 | |
@Column(name = "EFF_DT") |
68 | |
private Date effectiveDate; |
69 | |
|
70 | |
@Temporal(TemporalType.TIMESTAMP) |
71 | |
@Column(name = "EXPIR_DT") |
72 | |
private Date expirationDate; |
73 | |
|
74 | |
@OneToMany(cascade = CascadeType.ALL, mappedBy = "owner") |
75 | |
private List<DocumentAttribute> attributes; |
76 | |
|
77 | |
@ManyToOne(optional=true) |
78 | |
@JoinColumn(name = "TYPE") |
79 | |
private DocumentType type; |
80 | |
|
81 | |
|
82 | |
@Column(name = "STATE") |
83 | |
private String state; |
84 | |
|
85 | |
|
86 | |
@ManyToMany(fetch=FetchType.EAGER) |
87 | |
@JoinTable(name="KSDO_DOCUMENT_JN_DOC_CATEGORY", |
88 | |
joinColumns= |
89 | |
@JoinColumn(name="DOC_ID", referencedColumnName="DOC_ID"), |
90 | |
inverseJoinColumns= |
91 | |
@JoinColumn(name="CATEGORY_ID", referencedColumnName="CATEGORY_ID") |
92 | |
) |
93 | |
private List<DocumentCategory> categoryList; |
94 | |
|
95 | |
public String getName(){ |
96 | 10 | return name; |
97 | |
} |
98 | |
|
99 | |
public void setName(String name){ |
100 | 4 | this.name=name; |
101 | 4 | } |
102 | |
|
103 | |
public String getFileName(){ |
104 | 10 | return fileName; |
105 | |
} |
106 | |
|
107 | |
public void setFileName(String fileName){ |
108 | 4 | this.fileName=fileName; |
109 | 4 | } |
110 | |
|
111 | |
|
112 | |
|
113 | |
|
114 | |
public DocumentRichText getDescr() { |
115 | 10 | return descr; |
116 | |
} |
117 | |
|
118 | |
|
119 | |
|
120 | |
|
121 | |
public void setDescr(DocumentRichText descr) { |
122 | 4 | this.descr = descr; |
123 | 4 | } |
124 | |
|
125 | |
|
126 | |
public String getDocument(){ |
127 | 10 | return document; |
128 | |
} |
129 | |
|
130 | |
public void setDocument(String document){ |
131 | 4 | this.document=document; |
132 | 4 | } |
133 | |
|
134 | |
|
135 | |
|
136 | |
|
137 | |
public Date getEffectiveDate() { |
138 | 10 | return effectiveDate; |
139 | |
} |
140 | |
|
141 | |
|
142 | |
|
143 | |
|
144 | |
public void setEffectiveDate(Date effectiveDate) { |
145 | 4 | this.effectiveDate = effectiveDate; |
146 | 4 | } |
147 | |
|
148 | |
|
149 | |
|
150 | |
|
151 | |
public Date getExpirationDate() { |
152 | 10 | return expirationDate; |
153 | |
} |
154 | |
|
155 | |
|
156 | |
|
157 | |
|
158 | |
public void setExpirationDate(Date expirationDate) { |
159 | 4 | this.expirationDate = expirationDate; |
160 | 4 | } |
161 | |
|
162 | |
|
163 | |
@Override |
164 | |
public List<DocumentAttribute> getAttributes() { |
165 | 22 | return attributes; |
166 | |
} |
167 | |
|
168 | |
@Override |
169 | |
public void setAttributes(List<DocumentAttribute> attributes) { |
170 | 7 | this.attributes = attributes; |
171 | 7 | } |
172 | |
|
173 | |
|
174 | |
|
175 | |
|
176 | |
public DocumentType getType() { |
177 | 10 | return type; |
178 | |
} |
179 | |
|
180 | |
|
181 | |
|
182 | |
|
183 | |
public void setType(DocumentType type) { |
184 | 3 | this.type = type; |
185 | 3 | } |
186 | |
|
187 | |
|
188 | |
|
189 | |
|
190 | |
public String getState() { |
191 | 10 | return state; |
192 | |
} |
193 | |
|
194 | |
|
195 | |
|
196 | |
|
197 | |
public void setState(String state) { |
198 | 4 | this.state = state; |
199 | 4 | } |
200 | |
|
201 | |
|
202 | |
public List<DocumentCategory> getCategoryList(){ |
203 | 12 | return categoryList; |
204 | |
} |
205 | |
|
206 | |
public void setCategoryList(List<DocumentCategory> categoryList){ |
207 | 8 | this.categoryList = categoryList; |
208 | 8 | } |
209 | |
|
210 | |
} |