View Javadoc
1   /**
2    * Copyright 2005-2016 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.ArrayList;
19  import java.util.LinkedHashMap;
20  import java.util.List;
21  
22  import org.apache.struts.upload.FormFile;
23  import org.kuali.rice.krad.bo.PersistableAttachment;
24  import org.kuali.rice.krad.bo.PersistableAttachmentList;
25  import org.kuali.rice.krad.bo.PersistableBusinessObjectBase;
26  
27  public class AttachmentSample extends PersistableBusinessObjectBase implements PersistableAttachment, PersistableAttachmentList<MultiAttachmentSample> {
28      
29      private String id;
30      private String description;
31      
32      private String fileName;
33      private String contentType;
34      private byte[] attachmentContent;
35      private transient FormFile attachmentFile;
36      
37      private List<MultiAttachmentSample> attachments;
38      
39      public AttachmentSample() {
40          this.attachments = new ArrayList<MultiAttachmentSample>();
41      }
42  
43      public String getId() {
44          return this.id;
45      }
46  
47      public void setId(String id) {
48          this.id = id;
49      }
50  
51      public String getDescription() {
52          return this.description;
53      }
54  
55      public void setDescription(String description) {
56          this.description = description;
57      }
58  
59      public String getFileName() {
60          return this.fileName;
61      }
62  
63      public void setFileName(String fileName) {
64          this.fileName = fileName;
65      }
66  
67      public String getContentType() {
68          return this.contentType;
69      }
70  
71      public void setContentType(String contentType) {
72          this.contentType = contentType;
73      }
74  
75      public byte[] getAttachmentContent() {
76          return this.attachmentContent;
77      }
78  
79      public void setAttachmentContent(byte[] attachmentContent) {
80          this.attachmentContent = attachmentContent;
81      }
82  
83      public FormFile getAttachmentFile() {
84          return this.attachmentFile;
85      }
86  
87      public void setAttachmentFile(FormFile attachmentFile) {
88          this.attachmentFile = attachmentFile;
89      }
90  
91      @Override
92      public List<MultiAttachmentSample> getAttachments() {
93          return this.attachments;
94      }
95  
96      @Override
97      public void setAttachments(List<MultiAttachmentSample> attachments) {
98          this.attachments = attachments;
99      }
100 
101     protected LinkedHashMap toStringMapper() {
102         LinkedHashMap<String, Object> toStringMap = new LinkedHashMap<String, Object>();
103         toStringMap.put("id", id);
104         return toStringMap;
105     }
106 
107     @Override
108     public List buildListOfDeletionAwareLists() {
109         List managedLists = super.buildListOfDeletionAwareLists();
110         managedLists.add(this.attachments);
111         return managedLists;
112     }
113 }