List of usage examples for com.liferay.portal.kernel.portletfilerepository PortletFileRepositoryUtil fetchPortletRepository
public static Repository fetchPortletRepository(long groupId, String portletId)
From source file:com.bemis.portal.report.model.impl.ReportRequestImpl.java
License:Open Source License
@Override public long getAttachmentsFolderId() { if (_attachmentsFolderId != DLFolderConstants.DEFAULT_PARENT_FOLDER_ID) { return _attachmentsFolderId; }/* ww w .j av a2 s . c o m*/ ServiceContext serviceContext = new ServiceContext(); serviceContext.setAddGroupPermissions(true); serviceContext.setAddGuestPermissions(true); Repository repository = PortletFileRepositoryUtil.fetchPortletRepository(getGroupId(), ReportPortletKeys.REPORT_GENERATION_REQUEST); if (repository == null) { return DLFolderConstants.DEFAULT_PARENT_FOLDER_ID; } try { Folder folder = PortletFileRepositoryUtil.getPortletFolder(repository.getRepositoryId(), DLFolderConstants.DEFAULT_PARENT_FOLDER_ID, String.valueOf(getReportRequestId())); _attachmentsFolderId = folder.getFolderId(); } catch (Exception e) { if (_log.isDebugEnabled()) { _log.debug("No portlet repository for ReportRequest" + getReportRequestId(), e); } } return _attachmentsFolderId; }
From source file:com.liferay.blogs.service.impl.BlogsEntryLocalServiceImpl.java
License:Open Source License
@Override public Folder fetchAttachmentsFolder(long userId, long groupId) { ServiceContext serviceContext = new ServiceContext(); serviceContext.setAddGroupPermissions(true); serviceContext.setAddGuestPermissions(true); Repository repository = PortletFileRepositoryUtil.fetchPortletRepository(groupId, BlogsConstants.SERVICE_NAME); try {// w w w . j a va 2 s . co m Folder folder = PortletFileRepositoryUtil.getPortletFolder(repository.getRepositoryId(), DLFolderConstants.DEFAULT_PARENT_FOLDER_ID, BlogsConstants.SERVICE_NAME); return folder; } catch (Exception e) { } return null; }
From source file:com.liferay.journal.internal.upgrade.v1_1_0.UpgradeImageTypeContent.java
License:Open Source License
protected long getRepositoryId(long groupId) throws PortalException { Repository repository = PortletFileRepositoryUtil.fetchPortletRepository(groupId, JournalConstants.SERVICE_NAME); if (repository != null) { return repository.getRepositoryId(); }/*w ww . j a v a 2s .com*/ ServiceContext serviceContext = new ServiceContext(); serviceContext.setAddGroupPermissions(true); serviceContext.setAddGuestPermissions(true); repository = PortletFileRepositoryUtil.addPortletRepository(groupId, JournalConstants.SERVICE_NAME, serviceContext); return repository.getRepositoryId(); }
From source file:com.liferay.journal.model.impl.JournalArticleImpl.java
License:Open Source License
@Override public long getImagesFolderId() { if (_imagesFolderId != DLFolderConstants.DEFAULT_PARENT_FOLDER_ID) { return _imagesFolderId; }//from w w w . j a v a 2s . c o m Repository repository = PortletFileRepositoryUtil.fetchPortletRepository(getGroupId(), JournalConstants.SERVICE_NAME); if (repository == null) { return DLFolderConstants.DEFAULT_PARENT_FOLDER_ID; } try { Folder folder = PortletFileRepositoryUtil.getPortletFolder(repository.getRepositoryId(), DLFolderConstants.DEFAULT_PARENT_FOLDER_ID, String.valueOf(getResourcePrimKey())); _imagesFolderId = folder.getFolderId(); } catch (Exception e) { if (_log.isDebugEnabled()) { _log.debug("Unable to get folder for " + getResourcePrimKey()); } } return _imagesFolderId; }
From source file:com.liferay.wiki.model.impl.WikiNodeImpl.java
License:Open Source License
@Override public long getAttachmentsFolderId() { if (_attachmentsFolderId != DLFolderConstants.DEFAULT_PARENT_FOLDER_ID) { return _attachmentsFolderId; }//from www .j a v a 2 s. co m ServiceContext serviceContext = new ServiceContext(); serviceContext.setAddGroupPermissions(true); serviceContext.setAddGuestPermissions(true); Repository repository = PortletFileRepositoryUtil.fetchPortletRepository(getGroupId(), WikiConstants.SERVICE_NAME); if (repository == null) { return DLFolderConstants.DEFAULT_PARENT_FOLDER_ID; } try { Folder folder = PortletFileRepositoryUtil.getPortletFolder(repository.getRepositoryId(), DLFolderConstants.DEFAULT_PARENT_FOLDER_ID, String.valueOf(getNodeId())); _attachmentsFolderId = folder.getFolderId(); } catch (Exception e) { } return _attachmentsFolderId; }
From source file:com.liferay.wiki.model.impl.WikiPageImpl.java
License:Open Source License
@Override public long getAttachmentsFolderId() { if (_attachmentsFolderId != DLFolderConstants.DEFAULT_PARENT_FOLDER_ID) { return _attachmentsFolderId; }/* w ww . ja v a 2 s . com*/ ServiceContext serviceContext = new ServiceContext(); serviceContext.setAddGroupPermissions(true); serviceContext.setAddGuestPermissions(true); Repository repository = PortletFileRepositoryUtil.fetchPortletRepository(getGroupId(), WikiConstants.SERVICE_NAME); long nodeAttachmentsFolderId = getNodeAttachmentsFolderId(); if ((repository == null) || (nodeAttachmentsFolderId == DLFolderConstants.DEFAULT_PARENT_FOLDER_ID)) { return DLFolderConstants.DEFAULT_PARENT_FOLDER_ID; } try { Folder folder = PortletFileRepositoryUtil.getPortletFolder(repository.getRepositoryId(), nodeAttachmentsFolderId, String.valueOf(getResourcePrimKey())); _attachmentsFolderId = folder.getFolderId(); } catch (Exception e) { } return _attachmentsFolderId; }