001    package jmaster.jumploader.model.api.upload;
002    
003    import jmaster.jumploader.model.api.common.IAttributeSet;
004    import jmaster.jumploader.model.api.common.ITransferProgress;
005    import jmaster.jumploader.model.api.file.IFile;
006    
007    /**
008     * IUploadFile
009     * 
010     * @author timur
011     */
012    
013    public interface IUploadFile
014    extends IFile {
015            //---------------------------------------------------------------
016            //      constants
017            //---------------------------------------------------------------
018            /**
019             * generic file for upload
020             */
021            public static final int TYPE_FILE = 0;
022            /**
023             * a document for processing
024             */
025            public static final int TYPE_DOCUMENT = 1;
026            
027            public static final int STATUS_READY = 0;
028            public static final int STATUS_UPLOADING = 1;
029            public static final int STATUS_FINISHED = 2;
030            public static final int STATUS_FAILED = 3;
031            public static final int STATUS_PREPROCESSING = 4;
032            public static final int STATUS_DOWNLOADING = 5;
033            public static final int STATUS_EDITING = 6;
034            //---------------------------------------------------------------
035            //      business methods
036            //---------------------------------------------------------------
037            /**
038             * type retrieval, see constants
039             */
040            public int getType();
041            /**
042             * status retrieval
043             */
044            public int getStatus();
045            /**
046             * error retrieval, valid for STATUS_FAILED
047             */
048            public Exception getError();
049            /**
050             * transfer progress retrieval, valid for STATUS_UPLOADING
051             */
052            public ITransferProgress getTransferProgress();
053            /**
054             * shows whether is ready
055             */
056            public boolean isReady();
057            /**
058             * shows whether is preprocessing
059             */
060            public boolean isPreprocessing();
061            /**
062             * shows whether is server processing
063             */
064            public boolean isServerProcessing();
065            /**
066             * shows whether is uploading
067             */
068            public boolean isUploading();
069            /**
070             * shows whether is finished
071             */
072            public boolean isFinished();
073            /**
074             * shows whether is failed
075             */
076            public boolean isFailed();
077            /**
078             * file index retrieval (staring at 0)
079             */
080            public int getIndex();
081            /**
082             * shows whether this item could be removed from uploader
083             */
084            public boolean isRemovable();
085            /**
086             * shows whether this item could be retryed
087             */
088            public boolean isRetryable();
089            /**
090             * shows whether stop upload can be issued for this item
091             */
092            public boolean isStoppable();
093            /**
094             * @return the uploadedPartitionCount
095             */
096            public int getUploadedPartitionCount();
097            /**
098             * @param uploadedPartitionCount the uploadedPartitionCount to set
099             */
100            public void setUploadedPartitionCount( int uploadedPartitionCount );
101            /**
102             * shows whether file is editable image
103             */
104            public boolean isEditableImage();
105            /**
106             * server response content retrieval
107             */
108            public String getResponseContent();
109            /**
110             * server response headers retrieval
111             */
112            public IAttributeSet getResponseHeaders();
113            /**
114             * update file length
115             */
116            public void setLength( long length );
117            /**
118             * check whether file is temporary
119             */
120            public boolean isTempFile();
121            /**
122             * shows whether is downloading
123             */
124            public boolean isDownloading();
125            /**
126             * shows whether is editing
127             */
128            public boolean isEditing();
129            /**
130             * retrieve general purpose key
131             */
132            public String getKey();
133            /**
134             * store general purpose key
135             */
136            public void setKey( String key );
137            /**
138             * shows whether document file ever was locked
139             */
140            public boolean isDocumentFileWasLocked();
141            /**
142             * set document file ever was locked flag
143             */
144            public void setDocumentFileWasLocked(boolean documentFileWasLocked);
145    }