001 /* 002 * Copyright 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 org.kuali.kfs.sys.batch; 017 018 import java.io.File; 019 import java.util.Date; 020 import java.util.LinkedHashMap; 021 022 import org.kuali.rice.kns.bo.TransientBusinessObjectBase; 023 024 public class BatchFile extends TransientBusinessObjectBase { 025 private File file; 026 027 public BatchFile() { 028 } 029 030 public String getPath() { 031 return BatchFileUtils.pathRelativeToRootDirectory(file.getAbsoluteFile().getParentFile().getAbsolutePath()); 032 } 033 034 public String getFileName() { 035 return file.getName(); 036 } 037 038 public Date getLastModifiedDate() { 039 return new Date(file.lastModified()); 040 } 041 042 public long getFileSize() { 043 return file.length(); 044 } 045 046 @Override 047 protected LinkedHashMap toStringMapper() { 048 return null; 049 } 050 051 // purposely not creating a getter method, to prevent the file object from being unintentionally accessed via form parameters 052 public File retrieveFile() { 053 return file; 054 } 055 056 public void setFile(File file) { 057 this.file = file; 058 } 059 }