List of usage examples for com.liferay.portal.kernel.repository.model FileEntry getUserName
@Override
public String getUserName();
From source file:blade.document.action.configurationicon.BladeActionConfigurationIcon.java
License:Apache License
public String getURL(PortletRequest portletRequest, PortletResponse portletResponse) { HttpServletRequest servletRequest = _portal.getHttpServletRequest(portletRequest); ThemeDisplay themeDisplay = (ThemeDisplay) portletRequest.getAttribute(WebKeys.THEME_DISPLAY); FileEntry fileEntry = _retrieveFile(servletRequest); PortletURL portletURL = PortletURLFactoryUtil.create(servletRequest, "blade_document_action_portlet_BladeDocumentActionPortlet", themeDisplay.getPlid(), PortletRequest.RENDER_PHASE); String fileName = fileEntry.getFileName(); String mimeType = fileEntry.getMimeType(); String version = fileEntry.getVersion(); String createdDate = fileEntry.getCreateDate().toString(); String createdUserName = fileEntry.getUserName(); String statusLabel = null;/*w ww.jav a 2s . c o m*/ try { statusLabel = WorkflowConstants.getStatusLabel(fileEntry.getLatestFileVersion().getStatus()); } catch (PortalException pe) { _log.error(pe); } portletURL.setParameter("fileName", fileName); portletURL.setParameter("mimeType", mimeType); portletURL.setParameter("version", version); portletURL.setParameter("statusLabel", statusLabel); portletURL.setParameter("createdDate", createdDate); portletURL.setParameter("createdUserName", createdUserName); try { portletURL.setWindowState(LiferayWindowState.POP_UP); } catch (WindowStateException wse) { _log.error(wse); } StringBuilder stringBuilder = new StringBuilder(); stringBuilder.append("javascript:Liferay.Util.openWindow("); stringBuilder.append("{dialog: {cache: false,width:800,modal: true},"); stringBuilder.append("title: 'basic information',id: "); stringBuilder.append("'testPopupIdUnique',uri: '"); stringBuilder.append(portletURL.toString() + "'});"); return stringBuilder.toString(); }
From source file:com.liferay.document.library.internal.atom.FileEntryAtomCollectionAdapter.java
License:Open Source License
@Override public List<String> getEntryAuthors(FileEntry fileEntry) { List<String> authors = new ArrayList<>(); authors.add(fileEntry.getUserName()); return authors; }
From source file:com.liferay.item.selector.taglib.internal.util.ItemSelectorRepositoryEntryBrowserUtil.java
License:Open Source License
public static JSONObject getItemMetadataJSONObject(FileEntry fileEntry, Locale locale) throws PortalException { JSONObject itemMetadataJSONObject = JSONFactoryUtil.createJSONObject(); JSONArray groupsJSONArray = JSONFactoryUtil.createJSONArray(); JSONObject firstTabJSONObject = JSONFactoryUtil.createJSONObject(); JSONArray firstTabDataJSONArray = JSONFactoryUtil.createJSONArray(); FileVersion latestFileVersion = fileEntry.getLatestFileVersion(); firstTabDataJSONArray.put(_createJSONObject(LanguageUtil.get(locale, "format"), HtmlUtil.escape(latestFileVersion.getExtension()))); firstTabDataJSONArray.put(_createJSONObject(LanguageUtil.get(locale, "size"), TextFormatter.formatStorageSize(fileEntry.getSize(), locale))); firstTabDataJSONArray.put(_createJSONObject(LanguageUtil.get(locale, "name"), HtmlUtil.escape(DLUtil.getTitleWithExtension(fileEntry)))); Date modifiedDate = fileEntry.getModifiedDate(); firstTabDataJSONArray.put(_createJSONObject(LanguageUtil.get(locale, "modified"), LanguageUtil.format(locale, "x-ago-by-x", new Object[] { LanguageUtil.getTimeDescription(locale, System.currentTimeMillis() - modifiedDate.getTime(), true), HtmlUtil.escape(fileEntry.getUserName()) }))); firstTabJSONObject.put("data", firstTabDataJSONArray); firstTabJSONObject.put("title", LanguageUtil.get(locale, "file-info")); groupsJSONArray.put(firstTabJSONObject); JSONObject secondTabJSONObject = JSONFactoryUtil.createJSONObject(); JSONArray secondTabDataJSONArray = JSONFactoryUtil.createJSONArray(); secondTabDataJSONArray.put(_createJSONObject(LanguageUtil.get(locale, "version"), HtmlUtil.escape(latestFileVersion.getVersion()))); secondTabDataJSONArray.put(_createJSONObject(LanguageUtil.get(locale, "status"), WorkflowConstants.getStatusLabel(latestFileVersion.getStatus()))); secondTabJSONObject.put("data", secondTabDataJSONArray); secondTabJSONObject.put("title", LanguageUtil.get(locale, "version")); groupsJSONArray.put(secondTabJSONObject); itemMetadataJSONObject.put("groups", groupsJSONArray); return itemMetadataJSONObject; }
From source file:com.liferay.portlet.documentlibrary.atom.FileEntryAtomCollectionAdapter.java
License:Open Source License
public List<String> getEntryAuthors(FileEntry fileEntry) { List<String> authors = new ArrayList<String>(); authors.add(fileEntry.getUserName()); return authors; }
From source file:com.liferay.portlet.documentlibrary.service.impl.DLAppHelperLocalServiceImpl.java
License:Open Source License
public void addFileEntry(long userId, FileEntry fileEntry, FileVersion fileVersion, ServiceContext serviceContext) throws PortalException, SystemException { updateAsset(userId, fileEntry, fileVersion, serviceContext.getAssetCategoryIds(), serviceContext.getAssetTagNames(), serviceContext.getAssetLinkEntryIds()); if (PropsValues.DL_FILE_ENTRY_COMMENTS_ENABLED) { mbMessageLocalService.addDiscussionMessage(fileEntry.getUserId(), fileEntry.getUserName(), fileEntry.getGroupId(), DLFileEntryConstants.getClassName(), fileEntry.getFileEntryId(), WorkflowConstants.ACTION_PUBLISH); }/*from w w w.j av a2 s .c o m*/ if (fileVersion instanceof LiferayFileVersion) { DLFileVersion dlFileVersion = (DLFileVersion) fileVersion.getModel(); Map<String, Serializable> workflowContext = new HashMap<String, Serializable>(); workflowContext.put("event", DLSyncConstants.EVENT_ADD); WorkflowHandlerRegistryUtil.startWorkflowInstance(dlFileVersion.getCompanyId(), dlFileVersion.getGroupId(), userId, DLFileEntry.class.getName(), dlFileVersion.getFileVersionId(), dlFileVersion, serviceContext, workflowContext); } registerDLProcessorCallback(fileEntry); }
From source file:com.liferay.portlet.documentlibrary.sharepoint.DLSharepointStorageImpl.java
License:Open Source License
@Override public void addDocumentElements(SharepointRequest sharepointRequest, Element element) throws Exception { String parentFolderPath = sharepointRequest.getRootPath(); long groupId = SharepointUtil.getGroupId(parentFolderPath); long parentFolderId = getLastFolderId(groupId, parentFolderPath, DLFolderConstants.DEFAULT_PARENT_FOLDER_ID); if (parentFolderId == DLFolderConstants.DEFAULT_PARENT_FOLDER_ID) { return;/* ww w . j a v a 2 s .c o m*/ } List<FileEntry> fileEntries = DLAppServiceUtil.getFileEntries(groupId, parentFolderId); for (FileEntry fileEntry : fileEntries) { String documentPath = parentFolderPath.concat(StringPool.SLASH).concat(fileEntry.getTitle()); addDocumentElement(element, documentPath, fileEntry.getCreateDate(), fileEntry.getModifiedDate(), fileEntry.getUserName()); } }
From source file:com.liferay.portlet.documentlibrary.sharepoint.DLSharepointStorageImpl.java
License:Open Source License
protected Tree getFileEntryTree(FileEntry fileEntry, String parentFolderPath) { String documentPath = parentFolderPath.concat(StringPool.SLASH).concat(fileEntry.getTitle()); return getDocumentTree(documentPath, fileEntry.getCreateDate(), fileEntry.getModifiedDate(), fileEntry.getSize(), fileEntry.getUserName(), fileEntry.getVersion()); }