String cacheUrl = getBusiness().getFolderBusiness()
.getFolderPath(folder) + "/" + filename;
getBusiness().getSystemService().getFileCache().remove(cacheUrl);
String ext = FilenameUtils.getExtension(path);
logger.debug("path " + path + " filename " + filename + " ext " + ext);
FileEntity file = getDao().getFileDao().getByName(folder.getId(),
filename);
if (file == null) {
file = new FileEntity(filename, filename, folder.getId(),
MimeType.getContentTypeByExt(ext), new Date(), data.length);
logger.debug("created file " + file.getFilename());
}
getDao().getFileDao().save(file, data);
return file;
}