001/**
002 * Copyright 2005-2018 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 */
016package org.kuali.rice.krad.file;
017
018import org.springframework.web.multipart.MultipartFile;
019
020import java.util.Date;
021
022/**
023 * The file object interface used by the MultiFileUpload component(s), these component(s) expect objects which
024 * implement this interface.
025 *
026 * @author Kuali Rice Team (rice.collab@kuali.org)
027 */
028public interface FileMeta {
029    /**
030     * Init method called to initialize the FileMeta object
031     *
032     * @param multipartFile the file this object contains or represents
033     * @throws Exception
034     */
035    public void init(MultipartFile multipartFile) throws Exception;
036
037    /**
038     * Unique id of the FileMeta object
039     *
040     * @return
041     */
042    public String getId();
043
044    /**
045     * @see #getId()
046     */
047    public void setId(String id);
048
049    /**
050     * The name of the file
051     *
052     * @return
053     */
054    public String getName();
055
056    /**
057     * @see #getName()
058     */
059    public void setName(String name);
060
061    /**
062     * The content type of the file
063     *
064     * @return
065     */
066    public String getContentType();
067
068    /**
069     * @see #getContentType()
070     */
071    public void setContentType(String contentType);
072
073    /**
074     * The size of the file (in bytes)
075     *
076     * @return
077     */
078    public Long getSize();
079
080    /**
081     * @see #getSize()
082     */
083    public void setSize(Long size);
084
085    /**
086     * The size of the file formatted into a more readable format
087     *
088     * @return
089     */
090    public String getSizeFormatted();
091
092    /**
093     * The date the file was uploaded
094     *
095     * @return
096     */
097    public Date getDateUploaded();
098
099    /**
100     * @see #getDateUploaded()
101     */
102    public void setDateUploaded(Date dateUploaded);
103
104    /**
105     * The file uploaded date formatted ina more readable String format
106     *
107     * @return
108     */
109    public String getDateUploadedFormatted();
110
111    /**
112     * The url to use to download the file
113     *
114     * @return the url of the file download
115     */
116    public String getUrl();
117
118    /**
119     * @see #getUrl()
120     */
121    public void setUrl(String url);
122
123}