001    /*
002     * Copyright 2007-2011 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.LinkedHashMap;
019    
020    import javax.persistence.Column;
021    import javax.persistence.Entity;
022    import javax.persistence.Id;
023    import javax.persistence.Table;
024    
025    import org.apache.struts.upload.FormFile;
026    import org.kuali.rice.kns.bo.PersistableAttachment;
027    import org.kuali.rice.kns.bo.PersistableBusinessObjectBase;
028    
029    @Entity
030    @Table(name="TRV_MULTI_ATTACH_SAMPLE_T")
031    public class MultiAttachmentSample extends PersistableBusinessObjectBase implements PersistableAttachment {
032        
033            @Id
034            @Column(name="gen_id")
035        private Long genId;
036            @Column(name="description")
037        private String description;
038            @Column(name="attachment_filename")
039        private String fileName;
040            @Column(name="attachment_file_content_type")
041        private String contentType;
042            @Column(name="attachment_file")
043        private byte[] attachmentContent;
044        
045        private transient FormFile attachmentFile;
046            
047        public Long getGenId() {
048            return this.genId;
049        }
050    
051        public void setGenId(Long genId) {
052            this.genId = genId;
053        }
054    
055        public String getDescription() {
056            return this.description;
057        }
058    
059        public void setDescription(String description) {
060            this.description = description;
061        }
062    
063        public String getFileName() {
064            return this.fileName;
065        }
066    
067        public void setFileName(String fileName) {
068            this.fileName = fileName;
069        }
070    
071        public String getContentType() {
072            return this.contentType;
073        }
074    
075        public void setContentType(String contentType) {
076            this.contentType = contentType;
077        }
078    
079        public byte[] getAttachmentContent() {
080            return this.attachmentContent;
081        }
082    
083        public void setAttachmentContent(byte[] attachmentContent) {
084            this.attachmentContent = attachmentContent;
085        }
086    
087        public FormFile getAttachmentFile() {
088            return getAttachmentFile();
089        }
090        
091        public void setAttachmentFile(FormFile attachmentFile) {
092            this.attachmentFile = attachmentFile;
093        } 
094    
095        @Override
096        protected LinkedHashMap toStringMapper() {
097            LinkedHashMap<String, Object> toStringMap = new LinkedHashMap<String, Object>();
098            toStringMap.put("description", description);
099            return toStringMap;
100        }
101    }