View Javadoc

1   /*
2    * Copyright 2007-2011 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package edu.sampleu.travel.bo;
17  
18  import java.util.LinkedHashMap;
19  
20  import javax.persistence.Column;
21  import javax.persistence.Entity;
22  import javax.persistence.Id;
23  import javax.persistence.Table;
24  
25  import org.apache.struts.upload.FormFile;
26  import org.kuali.rice.kns.bo.PersistableAttachment;
27  import org.kuali.rice.kns.bo.PersistableBusinessObjectBase;
28  
29  @Entity
30  @Table(name="TRV_MULTI_ATTACH_SAMPLE_T")
31  public class MultiAttachmentSample extends PersistableBusinessObjectBase implements PersistableAttachment {
32      
33  	@Id
34  	@Column(name="gen_id")
35      private Long genId;
36  	@Column(name="description")
37      private String description;
38  	@Column(name="attachment_filename")
39      private String fileName;
40  	@Column(name="attachment_file_content_type")
41      private String contentType;
42  	@Column(name="attachment_file")
43      private byte[] attachmentContent;
44      
45      private transient FormFile attachmentFile;
46  	
47      public Long getGenId() {
48          return this.genId;
49      }
50  
51      public void setGenId(Long genId) {
52          this.genId = genId;
53      }
54  
55      public String getDescription() {
56          return this.description;
57      }
58  
59      public void setDescription(String description) {
60          this.description = description;
61      }
62  
63      public String getFileName() {
64          return this.fileName;
65      }
66  
67      public void setFileName(String fileName) {
68          this.fileName = fileName;
69      }
70  
71      public String getContentType() {
72          return this.contentType;
73      }
74  
75      public void setContentType(String contentType) {
76          this.contentType = contentType;
77      }
78  
79      public byte[] getAttachmentContent() {
80          return this.attachmentContent;
81      }
82  
83      public void setAttachmentContent(byte[] attachmentContent) {
84          this.attachmentContent = attachmentContent;
85      }
86  
87      public FormFile getAttachmentFile() {
88          return getAttachmentFile();
89      }
90      
91      public void setAttachmentFile(FormFile attachmentFile) {
92          this.attachmentFile = attachmentFile;
93      } 
94  
95      @Override
96      protected LinkedHashMap toStringMapper() {
97          LinkedHashMap<String, Object> toStringMap = new LinkedHashMap<String, Object>();
98          toStringMap.put("description", description);
99          return toStringMap;
100     }
101 }