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.common.entity.AttributeOwner;
38  import org.kuali.student.common.entity.MetaEntity;
39  /**
40   * This is a description of what this class does - lindholm don't forget to fill this in.
41   *
42   * @author Kuali Rice Team (kuali-rice@googlegroups.com)
43   *
44   */
45  @Entity
46  @Table(name = "KSDO_DOCUMENT")
47  @AttributeOverrides({
48      @AttributeOverride(name="id", column=@Column(name="DOC_ID"))})
49  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          return name;
97      }
98      
99      public void setName(String name){
100         this.name=name;
101     }
102     
103     public String getFileName(){
104         return fileName;
105     }
106     
107     public void setFileName(String fileName){
108         this.fileName=fileName;
109     }
110 
111     /**
112      * @return the commentText
113      */
114     public DocumentRichText getDescr() {
115         return descr;
116     }
117 
118     /**
119      * @param commentText the commentText to set
120      */
121     public void setDescr(DocumentRichText descr) {
122         this.descr = descr;
123     }
124     
125     
126     public String getDocument(){
127         return document;
128     }
129     
130     public void setDocument(String document){
131         this.document=document;
132     }
133 
134 	/**
135      * @return the effectiveDate
136      */
137     public Date getEffectiveDate() {
138         return effectiveDate;
139     }
140 
141     /**
142      * @param effectiveDate the effectiveDate to set
143      */
144     public void setEffectiveDate(Date effectiveDate) {
145         this.effectiveDate = effectiveDate;
146     }
147 
148     /**
149      * @return the expirationDate
150      */
151     public Date getExpirationDate() {
152         return expirationDate;
153     }
154 
155     /**
156      * @param expirationDate the expirationDate to set
157      */
158     public void setExpirationDate(Date expirationDate) {
159         this.expirationDate = expirationDate;
160     }
161 
162 
163     @Override
164     public List<DocumentAttribute> getAttributes() {
165         return attributes;
166     }
167 
168     @Override
169     public void setAttributes(List<DocumentAttribute> attributes) {
170         this.attributes = attributes;
171     }
172 
173     /**
174      * @return the type
175      */
176     public DocumentType getType() {
177         return type;
178     }
179 
180     /**
181      * @param type the type to set
182      */
183     public void setType(DocumentType type) {
184         this.type = type;
185     }
186 
187     /**
188      * @return the state
189      */
190     public String getState() {
191         return state;
192     }
193 
194     /**
195      * @param state the state to set
196      */
197     public void setState(String state) {
198         this.state = state;
199     }
200     
201     
202     public List<DocumentCategory> getCategoryList(){
203         return categoryList;
204     }
205     
206     public void setCategoryList(List<DocumentCategory> categoryList){
207         this.categoryList = categoryList;
208     }
209 
210 }