001: /*
002: * Copyright 2007 The Kuali Foundation.
003: *
004: * Licensed under the Educational Community License, Version 1.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/ecl1.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 org.kuali.kfs.batch;
017:
018: import java.io.File;
019: import java.util.List;
020: import java.util.Map;
021: import java.util.Set;
022:
023: import org.kuali.core.bo.user.UniversalUser;
024:
025: /**
026: * Declares methods that must be implemented for batch input file set type classes, which provides functionaliy needed to manage
027: * files of a certain batch type.
028: */
029: public interface BatchInputFileSetType extends BatchInputType {
030: /**
031: * Returns all of the types supported by this file set type
032: *
033: * @return a list of all file types supported. The values in the list do not have an externally usable meaning, and are meant to
034: * be used to call other methods of this interface.
035: */
036: public List<String> getFileTypes();
037:
038: /**
039: * Returns the unique identifier (Spring bean id) for the batch input file set type.
040: */
041: public String getFileSetTypeIdentifer();
042:
043: /**
044: * Gives the name of the directory for which batch files of a given type are stored.
045: *
046: * @param fileType the file type
047: */
048: public String getDirectoryPath(String fileType);
049:
050: /**
051: * Returns a map of file type to file type descriptions, which are intended to be human readable
052: *
053: * @return the key is the file type, the value is a human-readable description
054: */
055: public Map<String, String> getFileTypeDescription();
056:
057: /**
058: * Constructs a file name for the file type, the file user identifier, and the user.
059: *
060: * @param user - user who is uploading the file
061: * @param fileUserIdentifer - file identifier given by user through the batch upload UI
062: */
063: public String getFileName(String fileType, UniversalUser user,
064: String fileUserIdentifer);
065:
066: /**
067: * Returns whether the file must be uploaded
068: *
069: * @param fileType the type for the file
070: * @return whether it must be uploaded
071: */
072: public boolean isFileRequired(String fileType);
073:
074: /**
075: * Returns whether this batch input file set supports the creation of a done file
076: *
077: * @return
078: */
079: public boolean isSupportsDoneFileCreation();
080:
081: /**
082: * Returns the directory name where done files are to be stored. The behavior of this method is defined if
083: * {@link #isSupportsDoneFileCreation()} returns false.
084: *
085: * @return the done file directory name
086: */
087: public String getDoneFileDirectoryPath();
088:
089: /**
090: * Returns the file name of the done file for a fileset created by the user with the identifier. The behavior of this method is
091: * defined if {@link #isSupportsDoneFileCreation()} returns false.
092: *
093: * @return the done file name
094: */
095: public String getDoneFileName(UniversalUser user,
096: String fileUserIdentifer);
097:
098: /**
099: * Returns the set of file user identifiers parsed from the provided list of files for the user.
100: *
101: * @return a set of file user identifiers
102: */
103: public Set<String> extractFileUserIdentifiers(UniversalUser user,
104: List<File> files);
105: }
|