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.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.core.entity.AttributeOwner;
38  import org.kuali.student.core.entity.MetaEntity;
39  
40  /**
41   * This is a description of what this class does - lindholm don't forget to fill this in.
42   *
43   * @author Kuali Rice Team (kuali-rice@googlegroups.com)
44   *
45   */
46  @Entity
47  @Table(name = "KSDO_DOCUMENT")
48  @AttributeOverrides({
49      @AttributeOverride(name="id", column=@Column(name="DOC_ID"))})
50  public class Document extends MetaEntity implements AttributeOwner<DocumentAttribute> {
51      private static final long serialVersionUID = 1L;
52  
53      @Column(name = "NAME")
54      private String name;
55      
56      @Column(name = "FILE_NAME")
57      private String fileName;
58      
59      @ManyToOne(cascade = CascadeType.ALL)
60      @JoinColumn(name = "RT_DESCR_ID")
61      private DocumentRichText descr;
62  
63      @Lob
64      @Column(name = "DOCUMENT", length=10000000)
65      private String document;
66      
67      @Temporal(TemporalType.TIMESTAMP)
68      @Column(name = "EFF_DT")
69      private Date effectiveDate;
70  
71      @Temporal(TemporalType.TIMESTAMP)
72      @Column(name = "EXPIR_DT")
73      private Date expirationDate;
74      
75      @OneToMany(cascade = CascadeType.ALL, mappedBy = "owner")
76      private List<DocumentAttribute> attributes;
77      
78      @ManyToOne(optional=true)
79      @JoinColumn(name = "TYPE")
80      private DocumentType type;
81      
82      
83      @Column(name = "STATE")
84      private String state;
85      
86      
87      @ManyToMany(fetch=FetchType.EAGER)
88      @JoinTable(name="KSDO_DOCUMENT_JN_DOC_CATEGORY",
89              joinColumns=
90              @JoinColumn(name="DOC_ID", referencedColumnName="DOC_ID"),
91        inverseJoinColumns=
92              @JoinColumn(name="CATEGORY_ID", referencedColumnName="CATEGORY_ID")
93      )
94      private List<DocumentCategory> categoryList; 
95      
96      public String getName(){
97          return name;
98      }
99      
100     public void setName(String name){
101         this.name=name;
102     }
103     
104     public String getFileName(){
105         return fileName;
106     }
107     
108     public void setFileName(String fileName){
109         this.fileName=fileName;
110     }
111 
112     /**
113      * @return the commentText
114      */
115     public DocumentRichText getDescr() {
116         return descr;
117     }
118 
119     /**
120      * @param commentText the commentText to set
121      */
122     public void setDescr(DocumentRichText descr) {
123         this.descr = descr;
124     }
125     
126     
127     public String getDocument(){
128         return document;
129     }
130     
131     public void setDocument(String document){
132         this.document=document;
133     }
134 
135 	/**
136      * @return the effectiveDate
137      */
138     public Date getEffectiveDate() {
139         return effectiveDate;
140     }
141 
142     /**
143      * @param effectiveDate the effectiveDate to set
144      */
145     public void setEffectiveDate(Date effectiveDate) {
146         this.effectiveDate = effectiveDate;
147     }
148 
149     /**
150      * @return the expirationDate
151      */
152     public Date getExpirationDate() {
153         return expirationDate;
154     }
155 
156     /**
157      * @param expirationDate the expirationDate to set
158      */
159     public void setExpirationDate(Date expirationDate) {
160         this.expirationDate = expirationDate;
161     }
162 
163 
164     @Override
165     public List<DocumentAttribute> getAttributes() {
166         return attributes;
167     }
168 
169     @Override
170     public void setAttributes(List<DocumentAttribute> attributes) {
171         this.attributes = attributes;
172     }
173 
174     /**
175      * @return the type
176      */
177     public DocumentType getType() {
178         return type;
179     }
180 
181     /**
182      * @param type the type to set
183      */
184     public void setType(DocumentType type) {
185         this.type = type;
186     }
187 
188     /**
189      * @return the state
190      */
191     public String getState() {
192         return state;
193     }
194 
195     /**
196      * @param state the state to set
197      */
198     public void setState(String state) {
199         this.state = state;
200     }
201     
202     
203     public List<DocumentCategory> getCategoryList(){
204         return categoryList;
205     }
206     
207     public void setCategoryList(List<DocumentCategory> categoryList){
208         this.categoryList = categoryList;
209     }
210 
211 }