001    /**
002     * Copyright 2005-2013 The Kuali Foundation
003     *
004     * Licensed under the Educational Community License, Version 2.0 (the "License");
005     * you may not use this file except in compliance with the License.
006     * You may obtain a copy of the License at
007     *
008     * http://www.opensource.org/licenses/ecl2.php
009     *
010     * Unless required by applicable law or agreed to in writing, software
011     * distributed under the License is distributed on an "AS IS" BASIS,
012     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013     * See the License for the specific language governing permissions and
014     * limitations under the License.
015     */
016    package edu.sampleu.travel.bo;
017    
018    import java.util.ArrayList;
019    import java.util.LinkedHashMap;
020    import java.util.List;
021    
022    import org.apache.struts.upload.FormFile;
023    import org.kuali.rice.krad.bo.PersistableAttachment;
024    import org.kuali.rice.krad.bo.PersistableAttachmentList;
025    import org.kuali.rice.krad.bo.PersistableBusinessObjectBase;
026    
027    public class AttachmentSample extends PersistableBusinessObjectBase implements PersistableAttachment, PersistableAttachmentList<MultiAttachmentSample> {
028        
029        private String id;
030        private String description;
031        
032        private String fileName;
033        private String contentType;
034        private byte[] attachmentContent;
035        private transient FormFile attachmentFile;
036        
037        private List<MultiAttachmentSample> attachments;
038        
039        public AttachmentSample() {
040            this.attachments = new ArrayList<MultiAttachmentSample>();
041        }
042    
043        public String getId() {
044            return this.id;
045        }
046    
047        public void setId(String id) {
048            this.id = id;
049        }
050    
051        public String getDescription() {
052            return this.description;
053        }
054    
055        public void setDescription(String description) {
056            this.description = description;
057        }
058    
059        public String getFileName() {
060            return this.fileName;
061        }
062    
063        public void setFileName(String fileName) {
064            this.fileName = fileName;
065        }
066    
067        public String getContentType() {
068            return this.contentType;
069        }
070    
071        public void setContentType(String contentType) {
072            this.contentType = contentType;
073        }
074    
075        public byte[] getAttachmentContent() {
076            return this.attachmentContent;
077        }
078    
079        public void setAttachmentContent(byte[] attachmentContent) {
080            this.attachmentContent = attachmentContent;
081        }
082    
083        public FormFile getAttachmentFile() {
084            return this.attachmentFile;
085        }
086    
087        public void setAttachmentFile(FormFile attachmentFile) {
088            this.attachmentFile = attachmentFile;
089        }
090    
091        @Override
092        public List<MultiAttachmentSample> getAttachments() {
093            return this.attachments;
094        }
095    
096        @Override
097        public void setAttachments(List<MultiAttachmentSample> attachments) {
098            this.attachments = attachments;
099        }
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    }