}
}
@Override
public ServiceResponse saveFile(Map<String, String> vo) {
FileEntity file = null;
if (!StringUtils.isEmpty(vo.get("id"))) {
file = getDao().getFileDao().getById(Long.valueOf(vo.get("id")));
}
if (file == null) {
file = new FileEntity();
}
file.setFilename(vo.get("name"));
file.setTitle(vo.get("title"));
file.setFolderId(Long.valueOf(vo.get("folderId")));
file.setLastModifiedTime(new Date());
List<String> errors = getBusiness().getFileBusiness()
.validateBeforeUpdate(file);
if (errors.isEmpty()) {
FolderEntity folder = getDao().getFolderDao().getById(
file.getFolderId());
file.setMimeType(MimeType.getContentTypeByExt(
FolderUtil.getFileExt(file.getFilename())));
String cacheUrl = getBusiness().getFolderBusiness()
.getFolderPath(folder) + "/" + file.getFilename();
getBusiness().getSystemService().getFileCache().remove(cacheUrl);
getDao().getFileDao().save(file);
return ServiceResponse.createSuccessResponse(
Messages.get("file.success_update"));
}