use of com.liferay.portal.kernel.repository.model.FileEntry in project liferay-ide by liferay.
the class ShindigUtil method getFileEntryURL.
public static String getFileEntryURL(String portalURL, long fileEntryId) throws PortalException, SystemException {
FileEntry fileEntry = DLAppServiceUtil.getFileEntry(fileEntryId);
StringBundler sb = new StringBundler(6);
sb.append(portalURL);
sb.append(PortalUtil.getPathContext());
sb.append("/documents/");
sb.append(fileEntry.getRepositoryId());
sb.append(StringPool.SLASH);
sb.append(fileEntry.getUuid());
return sb.toString();
}
use of com.liferay.portal.kernel.repository.model.FileEntry in project liferay-ide by liferay.
the class KBArticleStagedModelDataHandler method exportKBArticleAttachments.
protected void exportKBArticleAttachments(PortletDataContext portletDataContext, Element kbArticleElement, KBArticle kbArticle) throws Exception {
List<FileEntry> attachmentsFileEntries = kbArticle.getAttachmentsFileEntries();
for (FileEntry fileEntry : attachmentsFileEntries) {
String path = ExportImportPathUtil.getModelPath(kbArticle, fileEntry.getTitle());
Element fileEntryElement = portletDataContext.getExportDataElement(fileEntry);
fileEntryElement.addAttribute("path", path);
fileEntryElement.addAttribute("file-name", fileEntry.getTitle());
portletDataContext.addZipEntry(path, fileEntry.getContentStream());
portletDataContext.addReferenceElement(kbArticle, kbArticleElement, fileEntry, PortletDataContext.REFERENCE_TYPE_WEAK, false);
}
}
use of com.liferay.portal.kernel.repository.model.FileEntry in project liferay-ide by liferay.
the class AdminSubscriptionSender method getEmailKBArticleAttachments.
protected String getEmailKBArticleAttachments(Locale locale) throws Exception {
List<FileEntry> attachmentsFileEntries = _kbArticle.getAttachmentsFileEntries();
if (attachmentsFileEntries.isEmpty()) {
return StringPool.BLANK;
}
StringBundler sb = new StringBundler(attachmentsFileEntries.size() * 5);
for (FileEntry fileEntry : attachmentsFileEntries) {
sb.append(fileEntry.getTitle());
sb.append(" (");
sb.append(TextFormatter.formatStorageSize(fileEntry.getSize(), locale));
sb.append(")");
sb.append("<br />");
}
return sb.toString();
}
use of com.liferay.portal.kernel.repository.model.FileEntry in project liferay-blade-samples by liferay.
the class BladeActionConfigurationIcon method _retrieveFile.
private FileEntry _retrieveFile(HttpServletRequest request) {
try {
long fileEntryId = ParamUtil.getLong(request, "fileEntryId");
FileEntry fileEntry = null;
if (fileEntryId > 0) {
fileEntry = _dlAppService.getFileEntry(fileEntryId);
}
if (fileEntry == null) {
return null;
}
String cmd = ParamUtil.getString(request, Constants.CMD);
if (fileEntry.isInTrash() && !cmd.equals(Constants.MOVE_FROM_TRASH)) {
return null;
}
return fileEntry;
} catch (PortalException pe) {
_log.log(LogService.LOG_ERROR, pe.getMessage(), pe);
return null;
}
}
Aggregations