com.seeyon.ctp.common.filemanager.manager
接口 FileManager


public interface FileManager


方法摘要
 com.seeyon.ctp.common.po.filemanager.V3XFile clone(java.lang.Long originalFileId)
          复制一个文件,现从文件总表中根据originalFileId读取文件信息,再复制文件,设置新的fileId,文件名称前加copy 用于office控件清稿备份
 com.seeyon.ctp.common.po.filemanager.V3XFile clone(java.lang.Long originalFileId, boolean saveDB)
          复制一个文件,现从文件总表中根据originalFileId读取文件信息,再复制文件,设置新的fileId
 void clone(java.lang.Long originalFileId, java.util.Date originalCreateDate, java.lang.Long newFileId, java.util.Date newCreateDate)
          根据originalFileId和createDate能够定位文件物理位置,并按照新的创建时间复制
 java.lang.Long copyFileBeforeModify(java.lang.Long fileId)
          在进行编辑上传类型的文件时,替换之前保存一份历史,区别于正常的替换
 void copyWPS(java.lang.Long sourceId)
          手动备份WPS的上传类型----文字和表格,备份的命名规则和普通office相同,见HandWriterManage.java----L340
 java.util.List<com.seeyon.ctp.common.po.filemanager.V3XFile> create(com.seeyon.ctp.common.constants.ApplicationCategoryEnum category, javax.servlet.http.HttpServletRequest request)
          从前端通过v3x:fileupload组件上传的文件直接存到文件系统中去
该方法不负责文件的上传
 java.io.File decryptionFile(java.io.File file)
          解密文件。
 void deleteFile(java.lang.Long fileId, java.lang.Boolean deletePhysicsFile)
          删除文件
 void deleteFile(java.lang.Long fileId, java.util.Date createDate, java.lang.Boolean deletePhysicsFile)
          删除文件
 java.util.List<com.seeyon.ctp.common.po.filemanager.V3XFile> findByFileName(java.lang.String fileName)
           
 java.io.File getFile(java.lang.Long fileId)
          根据文件Id,获得文件对象
 java.io.File getFile(java.lang.Long fileName, java.util.Date createDate)
          根据文件名和文件生成时间,获得文件对象
 byte[] getFileBytes(java.lang.Long fileId)
          得到文件字节
 byte[] getFileBytes(java.lang.Long fileId, java.util.Date createDate)
          得到文件字节
 java.io.File getFileDecryption(java.lang.Long fileId)
          获取解密后的文件
 java.io.File getFileDecryption(java.lang.Long fileId, java.util.Date createDate)
          获取解密后的文件
 java.lang.Long getFileIdByDocResSourceId(java.lang.Long fileId)
          通过文档的sourceId获得file
 java.io.InputStream getFileInputStream(java.lang.Long fileId)
          得到文件IO
 java.io.InputStream getFileInputStream(java.lang.Long fileId, java.util.Date createDate)
          得到文件IO
 java.lang.String getFolder(java.util.Date createDate, boolean createWhenNoExist)
          根据文件创建时间,获取文件上传目录,目录结构: 分区目录/yyyy/MM/dd
如: F:/upload/2006/05/09
 java.lang.String getNowFolder(boolean createWhenNoExist)
          得到当前的存储路径,目录结构: 分区目录/yyyy/MM/dd
 java.io.File getStandardOffice(java.lang.Long fileId, java.util.Date createDate)
          得到Office正文的标准格式
 java.io.File getStandardOffice(java.lang.String fileAbsolutePath)
          传入文件绝对路径
 java.io.InputStream getStandardOfficeInputStream(java.lang.Long fileId, java.util.Date createDate)
          得到Office正文的标准格式
 java.io.File getThumFile(java.lang.Long fileId, java.util.Date createDate)
           
 com.seeyon.ctp.common.po.filemanager.V3XFile getV3XFile(java.lang.Long fileId)
          得到V3XFile文件对象
 java.util.List<com.seeyon.ctp.common.po.filemanager.V3XFile> getV3XFile(java.lang.Long[] fileIds)
          得到V3XFile文件对象
 com.seeyon.ctp.common.po.filemanager.V3XFile save(java.io.File file, com.seeyon.ctp.common.constants.ApplicationCategoryEnum category, java.lang.String filename, java.util.Date createDate, java.lang.Boolean isSaveToDB)
          把文件存到文件系统中去
 com.seeyon.ctp.common.po.filemanager.V3XFile save(java.io.InputStream in, com.seeyon.ctp.common.constants.ApplicationCategoryEnum category, java.lang.String filename, java.util.Date createDate, java.lang.Boolean isSaveToDB)
          把输入流存到文件系统中去
 com.seeyon.ctp.common.po.filemanager.V3XFile save(java.lang.String bodyData, com.seeyon.ctp.common.constants.ApplicationCategoryEnum category, java.lang.String filename, java.util.Date createDate, java.lang.Boolean isSaveToDB)
          把文本存到文件系统中去
 void save(com.seeyon.ctp.common.po.filemanager.V3XFile file)
          记录文件信息,只在文件表中记录信息,文件是否已经上传不关心
 void update(com.seeyon.ctp.common.po.filemanager.V3XFile file)
           
 java.util.Map<java.lang.String,com.seeyon.ctp.common.po.filemanager.V3XFile> uploadFiles(javax.servlet.http.HttpServletRequest request, java.lang.String allowExtensions, java.io.File destFile, java.lang.Long maxSize)
          通过Portlet方式上传一个文件
只负责把文件存放在指定的位置
不把文件信息写进v3x_file表
约定:<input type='file' name='file1'>的name为file1
 java.util.Map<java.lang.String,com.seeyon.ctp.common.po.filemanager.V3XFile> uploadFiles(javax.servlet.http.HttpServletRequest request, java.lang.String allowExtensions, java.lang.Long maxSize)
          通过Portlet方式上传多个文件
只负责把文件存放在硬盘上
不把文件信息写进v3x_file表
 java.util.Map<java.lang.String,com.seeyon.ctp.common.po.filemanager.V3XFile> uploadFiles(javax.servlet.http.HttpServletRequest request, java.lang.String allowExtensions, java.util.Map<java.lang.String,java.io.File> destFiles, java.lang.Long maxSize)
          通过Portlet方式上传一个文件
只负责把文件存放在指定的位置
不把文件信息写进v3x_file表
 java.util.Map<java.lang.String,com.seeyon.ctp.common.po.filemanager.V3XFile> uploadFiles(javax.servlet.http.HttpServletRequest request, java.lang.String allowExtensions, java.lang.String destDirectory, java.lang.Long maxSize)
          通过Portlet方式上传多个文件
只负责把文件存放在指定的位置
不把文件信息写进v3x_file表
 

方法详细信息

save

void save(com.seeyon.ctp.common.po.filemanager.V3XFile file)
记录文件信息,只在文件表中记录信息,文件是否已经上传不关心

参数:
file -

update

void update(com.seeyon.ctp.common.po.filemanager.V3XFile file)

save

com.seeyon.ctp.common.po.filemanager.V3XFile save(java.io.File file,
                                                  com.seeyon.ctp.common.constants.ApplicationCategoryEnum category,
                                                  java.lang.String filename,
                                                  java.util.Date createDate,
                                                  java.lang.Boolean isSaveToDB)
                                                  throws BusinessException
把文件存到文件系统中去

参数:
file - 要保存的文件对象
category - 所属应用类别
filename - 显示文件名
createDate - 文件存储日期,一般就是此刻,用new Date()
isSaveToDB - 是否把V3XFile对象存到数据库中去,如果不存,在清理文件时将会被清理掉
返回:
抛出:
BusinessException

save

com.seeyon.ctp.common.po.filemanager.V3XFile save(java.io.InputStream in,
                                                  com.seeyon.ctp.common.constants.ApplicationCategoryEnum category,
                                                  java.lang.String filename,
                                                  java.util.Date createDate,
                                                  java.lang.Boolean isSaveToDB)
                                                  throws BusinessException
把输入流存到文件系统中去

参数:
in -
category - 所属应用类别
filename - 显示文件名
createDate - 文件存储日期,一般就是此刻,用new Date()
isSaveToDB - 是否把V3XFile对象存到数据库中去,如果不存,在清理文件时将会被清理掉
返回:
抛出:
BusinessException

save

com.seeyon.ctp.common.po.filemanager.V3XFile save(java.lang.String bodyData,
                                                  com.seeyon.ctp.common.constants.ApplicationCategoryEnum category,
                                                  java.lang.String filename,
                                                  java.util.Date createDate,
                                                  java.lang.Boolean isSaveToDB)
                                                  throws BusinessException
把文本存到文件系统中去

参数:
bodyData - 文本内容
category - 所属分类
filename - 显示文件名
createDate - 文件存储日期,一般就是此刻,用new Date()
isSaveToDB - 是否把V3XFile对象存到数据库中去,如果不存,在清理文件时将会被清理掉
返回:
V3XFile
抛出:
BusinessException

create

java.util.List<com.seeyon.ctp.common.po.filemanager.V3XFile> create(com.seeyon.ctp.common.constants.ApplicationCategoryEnum category,
                                                                    javax.servlet.http.HttpServletRequest request)
                                                                    throws BusinessException
从前端通过v3x:fileupload组件上传的文件直接存到文件系统中去
该方法不负责文件的上传

参数:
category -
request -
返回:
抛出:
BusinessException

getNowFolder

java.lang.String getNowFolder(boolean createWhenNoExist)
                              throws BusinessException
得到当前的存储路径,目录结构: 分区目录/yyyy/MM/dd

参数:
createWhenNoExist -
返回:
如: F:/upload/2006/05/09
抛出:
BusinessException

getFolder

java.lang.String getFolder(java.util.Date createDate,
                           boolean createWhenNoExist)
                           throws BusinessException
根据文件创建时间,获取文件上传目录,目录结构: 分区目录/yyyy/MM/dd
如: F:/upload/2006/05/09

参数:
createDate - 文件创建时间
createWhenNoExist - 当不存在该文件夹时创建之
返回:
抛出:
BusinessException - 没有分区

getV3XFile

com.seeyon.ctp.common.po.filemanager.V3XFile getV3XFile(java.lang.Long fileId)
                                                        throws BusinessException
得到V3XFile文件对象

参数:
fileId -
返回:
抛出:
BusinessException

getV3XFile

java.util.List<com.seeyon.ctp.common.po.filemanager.V3XFile> getV3XFile(java.lang.Long[] fileIds)
                                                                        throws BusinessException
得到V3XFile文件对象

参数:
fileId -
返回:
抛出:
BusinessException

getFile

java.io.File getFile(java.lang.Long fileId)
                     throws BusinessException
根据文件Id,获得文件对象

参数:
fileId -
返回:
抛出:
BusinessException - 文件不存在

getFile

java.io.File getFile(java.lang.Long fileName,
                     java.util.Date createDate)
                     throws BusinessException
根据文件名和文件生成时间,获得文件对象

参数:
fileName - 对应file表中的id,attachment表的fileurl
createDate - 文件不存在
返回:
抛出:
BusinessException

getThumFile

java.io.File getThumFile(java.lang.Long fileId,
                         java.util.Date createDate)
                         throws BusinessException
抛出:
BusinessException

getFileInputStream

java.io.InputStream getFileInputStream(java.lang.Long fileId)
                                       throws BusinessException
得到文件IO

参数:
fileId -
返回:
抛出:
BusinessException

getFileInputStream

java.io.InputStream getFileInputStream(java.lang.Long fileId,
                                       java.util.Date createDate)
                                       throws BusinessException
得到文件IO

参数:
fileId -
createDate -
返回:
抛出:
BusinessException

getFileBytes

byte[] getFileBytes(java.lang.Long fileId)
                    throws BusinessException
得到文件字节

参数:
fileId -
返回:
抛出:
BusinessException

getFileBytes

byte[] getFileBytes(java.lang.Long fileId,
                    java.util.Date createDate)
                    throws BusinessException
得到文件字节

参数:
fileId -
返回:
抛出:
BusinessException

uploadFiles

java.util.Map<java.lang.String,com.seeyon.ctp.common.po.filemanager.V3XFile> uploadFiles(javax.servlet.http.HttpServletRequest request,
                                                                                         java.lang.String allowExtensions,
                                                                                         java.lang.Long maxSize)
                                                                                         throws BusinessException
通过Portlet方式上传多个文件
只负责把文件存放在硬盘上
不把文件信息写进v3x_file表

参数:
request -
allowExtensions - 允许的后缀名,多个用,分割,如: jpeg,jpg,gif,png,不区分大小写,可以为空
maxSize - 最大byte
返回:
Map fieldName-V3XFile对
抛出:
BusinessException

uploadFiles

java.util.Map<java.lang.String,com.seeyon.ctp.common.po.filemanager.V3XFile> uploadFiles(javax.servlet.http.HttpServletRequest request,
                                                                                         java.lang.String allowExtensions,
                                                                                         java.io.File destFile,
                                                                                         java.lang.Long maxSize)
                                                                                         throws BusinessException
通过Portlet方式上传一个文件
只负责把文件存放在指定的位置
不把文件信息写进v3x_file表
约定:<input type='file' name='file1'>的name为file1

参数:
request -
allowExtensions - 允许的后缀名,多个用,分割,如: jpeg,jpg,gif,png,不区分大小写,可以为空
destFile - 指定的文件名,采用全名,如c:\ext\log.txt
maxSize - 最大byte
返回:
Map fieldName-V3XFile对
抛出:
BusinessException

uploadFiles

java.util.Map<java.lang.String,com.seeyon.ctp.common.po.filemanager.V3XFile> uploadFiles(javax.servlet.http.HttpServletRequest request,
                                                                                         java.lang.String allowExtensions,
                                                                                         java.util.Map<java.lang.String,java.io.File> destFiles,
                                                                                         java.lang.Long maxSize)
                                                                                         throws BusinessException
通过Portlet方式上传一个文件
只负责把文件存放在指定的位置
不把文件信息写进v3x_file表

参数:
request -
allowExtensions -
destFiles - Map fieldName-File对
返回:
抛出:
BusinessException

uploadFiles

java.util.Map<java.lang.String,com.seeyon.ctp.common.po.filemanager.V3XFile> uploadFiles(javax.servlet.http.HttpServletRequest request,
                                                                                         java.lang.String allowExtensions,
                                                                                         java.lang.String destDirectory,
                                                                                         java.lang.Long maxSize)
                                                                                         throws BusinessException
通过Portlet方式上传多个文件
只负责把文件存放在指定的位置
不把文件信息写进v3x_file表

参数:
request -
allowExtensions - 允许的后缀名,多个用,分割,如: jpeg,jpg,gif,png,不区分大小写,可以为空
type -
destDirectory - 上传到指定的文件夹
maxSize - 最大byte
返回:
Map fieldName-V3XFile对
抛出:
BusinessException

deleteFile

void deleteFile(java.lang.Long fileId,
                java.lang.Boolean deletePhysicsFile)
                throws BusinessException
删除文件

参数:
fileId -
deletePhysicsFile - 是否删除物理文件
抛出:
BusinessException

deleteFile

void deleteFile(java.lang.Long fileId,
                java.util.Date createDate,
                java.lang.Boolean deletePhysicsFile)
                throws BusinessException
删除文件

参数:
fileId -
createDate -
deletePhysicsFile - 是否删除物理文件
抛出:
BusinessException

clone

com.seeyon.ctp.common.po.filemanager.V3XFile clone(java.lang.Long originalFileId,
                                                   boolean saveDB)
                                                   throws BusinessException,
                                                          java.io.FileNotFoundException
复制一个文件,现从文件总表中根据originalFileId读取文件信息,再复制文件,设置新的fileId

参数:
originalFileId - 要复制的文件的id
saveDB - 是否同时保存到数据库
返回:
抛出:
BusinessException
java.io.FileNotFoundException

clone

com.seeyon.ctp.common.po.filemanager.V3XFile clone(java.lang.Long originalFileId)
                                                   throws BusinessException,
                                                          java.io.FileNotFoundException
复制一个文件,现从文件总表中根据originalFileId读取文件信息,再复制文件,设置新的fileId,文件名称前加copy 用于office控件清稿备份

参数:
originalFileId - 要复制的文件的id
返回:
抛出:
BusinessException
java.io.FileNotFoundException

clone

void clone(java.lang.Long originalFileId,
           java.util.Date originalCreateDate,
           java.lang.Long newFileId,
           java.util.Date newCreateDate)
           throws BusinessException,
                  java.io.FileNotFoundException
根据originalFileId和createDate能够定位文件物理位置,并按照新的创建时间复制

参数:
originalFileId -
originalCreateDate -
newFileId -
newCreateDate -
抛出:
BusinessException
java.io.FileNotFoundException

getStandardOffice

java.io.File getStandardOffice(java.lang.Long fileId,
                               java.util.Date createDate)
                               throws BusinessException
得到Office正文的标准格式

参数:
fileId -
createDate -
返回:
抛出:
BusinessException

getStandardOfficeInputStream

java.io.InputStream getStandardOfficeInputStream(java.lang.Long fileId,
                                                 java.util.Date createDate)
                                                 throws BusinessException,
                                                        java.io.FileNotFoundException
得到Office正文的标准格式

参数:
fileId -
createDate -
返回:
抛出:
BusinessException
java.io.FileNotFoundException

findByFileName

java.util.List<com.seeyon.ctp.common.po.filemanager.V3XFile> findByFileName(java.lang.String fileName)

copyFileBeforeModify

java.lang.Long copyFileBeforeModify(java.lang.Long fileId)
在进行编辑上传类型的文件时,替换之前保存一份历史,区别于正常的替换


getFileIdByDocResSourceId

java.lang.Long getFileIdByDocResSourceId(java.lang.Long fileId)
通过文档的sourceId获得file


copyWPS

void copyWPS(java.lang.Long sourceId)
手动备份WPS的上传类型----文字和表格,备份的命名规则和普通office相同,见HandWriterManage.java----L340


getStandardOffice

java.io.File getStandardOffice(java.lang.String fileAbsolutePath)
                               throws BusinessException
传入文件绝对路径

抛出:
BusinessException

decryptionFile

java.io.File decryptionFile(java.io.File file)
解密文件。因通过附件组件上传的文件时加密的,在使用前需要解密。

参数:
file - 被加密的文件
返回:
解密后的文件

getFileDecryption

java.io.File getFileDecryption(java.lang.Long fileId,
                               java.util.Date createDate)
                               throws BusinessException
获取解密后的文件

参数:
fileId -
createDate -
返回:
抛出:
BusinessException

getFileDecryption

java.io.File getFileDecryption(java.lang.Long fileId)
                               throws BusinessException
获取解密后的文件

参数:
fileId -
返回:
抛出:
BusinessException