public static File getGroovyScriptFile(File storageDir, String pageId) { return RandomUtil.getCodeFile(storageDir, GROOVY_FILE_NAME_PATTERN, pageId); }
protected File getEmailAttachmentsDirectory(String emailId) { return RandomUtil.getCodeFile(queuedDirectory, "email-{0}-attachments", emailId); }
protected File getMetaFile(String code) { return RandomUtil.getCodeFile(blobsDir, metaFileNamePattern, code); }
public static File getTempCodeFile(String fileNameFormat, String randomCode) { return getCodeFile(tempDir, fileNameFormat, randomCode); }
public static File getTempCodeFile(String fileNameFormat, String randomCode) { return getCodeFile(tempDir, fileNameFormat, randomCode); }
protected File getDataFile(String code) { return RandomUtil.getCodeFile(blobsDir, dataFileNamePattern, code); }
protected File getMetaFile(String code) { return RandomUtil.getCodeFile(blobsDir, metaFileNamePattern, code); }
protected File getDataFile(String code) { return RandomUtil.getCodeFile(blobsDir, dataFileNamePattern, code); }
protected File getEmailFile(String emailId) { return RandomUtil.getCodeFile(queuedDirectory, "email-{0}.xml", emailId); }
@Override protected File getMetaFile(String code) { File dir = getBlobSubdir(code); return RandomUtil.getCodeFile(dir, metaFileNamePattern, code); }
@Override protected File getDataFile(String code) { File dir = getBlobSubdir(code); return RandomUtil.getCodeFile(dir, dataFileNamePattern, code); }
@Override protected File getMetaFile(String code) { File dir = getBlobSubdir(code); return RandomUtil.getCodeFile(dir, metaFileNamePattern, code); }
@Override protected File getDataFile(String code) { File dir = getBlobSubdir(code); return RandomUtil.getCodeFile(dir, dataFileNamePattern, code); }
protected void commonUploadAttachment() throws IOException { logger.debug("Uploading attachment"); viewAttachmentUrl = null; InputStream attachmentStream = upload.getInputStream(); String attachmentId = RandomUtil.createRandomId(); File dataFile = RandomUtil.getCodeFile( pageInstance.getDirectory(), ATTACHMENT_FILE_NAME_PATTERN, attachmentId); // copy the data FileOutputStream fileOutputStream = new FileOutputStream(dataFile); IOUtils.copyLarge(attachmentStream, fileOutputStream); if(textConfiguration == null) { textConfiguration = new TextConfiguration(); } Attachment attachment = TextLogic.createAttachment( textConfiguration, attachmentId, upload.getFileName(), upload.getContentType(), upload.getSize()); attachment.setDownloadable(uploadDownloadable); viewAttachmentUrl = generateViewAttachmentUrl(attachmentId); saveConfiguration(textConfiguration); logger.info("Attachment uploaded: " + upload.getFileName() + " (" + attachmentId + ")"); IOUtils.closeQuietly(attachmentStream); IOUtils.closeQuietly(fileOutputStream); upload.delete(); logger.debug("Upload resources cleaned"); }
final File file = RandomUtil.getCodeFile( pageInstance.getDirectory(), ATTACHMENT_FILE_NAME_PATTERN, attachmentId);
continue; File file = RandomUtil.getCodeFile( pageInstance.getDirectory(), ATTACHMENT_FILE_NAME_PATTERN, attachment.getId()); if(!FileUtils.deleteQuietly(file)) {