Example usage for com.liferay.portal.kernel.portletfilerepository PortletFileRepositoryUtil getPortletFolder

List of usage examples for com.liferay.portal.kernel.portletfilerepository PortletFileRepositoryUtil getPortletFolder

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.portletfilerepository PortletFileRepositoryUtil getPortletFolder.

Prototype

public static Folder getPortletFolder(long folderId) throws PortalException 

Source Link

Usage

From source file:com.bemis.portal.report.model.impl.ReportRequestImpl.java

License:Open Source License

@Override
public Folder addAttachmentsFolder() throws PortalException {
    if (_attachmentsFolderId != DLFolderConstants.DEFAULT_PARENT_FOLDER_ID) {

        return PortletFileRepositoryUtil.getPortletFolder(_attachmentsFolderId);
    }//  w  ww .  j  a  va2  s  .com

    ServiceContext serviceContext = new ServiceContext();

    serviceContext.setAddGroupPermissions(true);
    serviceContext.setAddGuestPermissions(true);

    Repository repository = PortletFileRepositoryUtil.addPortletRepository(getGroupId(),
            ReportPortletKeys.REPORT_GENERATION_REQUEST, serviceContext);

    Folder folder = PortletFileRepositoryUtil.addPortletFolder(getUserId(), repository.getRepositoryId(),
            DLFolderConstants.DEFAULT_PARENT_FOLDER_ID, String.valueOf(getReportRequestId()), serviceContext);

    _attachmentsFolderId = folder.getFolderId();

    return folder;
}

From source file:com.liferay.journal.model.impl.JournalArticleImpl.java

License:Open Source License

@Override
public Folder addImagesFolder() throws PortalException {
    if (_imagesFolderId != DLFolderConstants.DEFAULT_PARENT_FOLDER_ID) {
        return PortletFileRepositoryUtil.getPortletFolder(_imagesFolderId);
    }//  w w  w.  j  a  v  a2  s .co m

    ServiceContext serviceContext = new ServiceContext();

    serviceContext.setAddGroupPermissions(true);
    serviceContext.setAddGuestPermissions(true);

    Repository repository = PortletFileRepositoryUtil.addPortletRepository(getGroupId(),
            JournalConstants.SERVICE_NAME, serviceContext);

    Folder folder = PortletFileRepositoryUtil.addPortletFolder(getUserId(), repository.getRepositoryId(),
            DLFolderConstants.DEFAULT_PARENT_FOLDER_ID, String.valueOf(getResourcePrimKey()), serviceContext);

    _imagesFolderId = folder.getFolderId();

    return folder;
}

From source file:com.liferay.wiki.model.impl.WikiNodeImpl.java

License:Open Source License

@Override
public Folder addAttachmentsFolder() throws PortalException {
    if (_attachmentsFolderId != DLFolderConstants.DEFAULT_PARENT_FOLDER_ID) {

        return PortletFileRepositoryUtil.getPortletFolder(_attachmentsFolderId);
    }/*from w  w  w  . j  a  v  a2 s  . c  o m*/

    ServiceContext serviceContext = new ServiceContext();

    serviceContext.setAddGroupPermissions(true);
    serviceContext.setAddGuestPermissions(true);

    Repository repository = PortletFileRepositoryUtil.addPortletRepository(getGroupId(),
            WikiConstants.SERVICE_NAME, serviceContext);

    Folder folder = PortletFileRepositoryUtil.addPortletFolder(getUserId(), repository.getRepositoryId(),
            DLFolderConstants.DEFAULT_PARENT_FOLDER_ID, String.valueOf(getNodeId()), serviceContext);

    _attachmentsFolderId = folder.getFolderId();

    return folder;
}

From source file:com.liferay.wiki.model.impl.WikiPageImpl.java

License:Open Source License

@Override
public Folder addAttachmentsFolder() throws PortalException {
    if (_attachmentsFolderId != DLFolderConstants.DEFAULT_PARENT_FOLDER_ID) {

        return PortletFileRepositoryUtil.getPortletFolder(_attachmentsFolderId);
    }//from w w w .  j a  v a 2s  .  com

    ServiceContext serviceContext = new ServiceContext();

    serviceContext.setAddGroupPermissions(true);
    serviceContext.setAddGuestPermissions(true);

    Repository repository = PortletFileRepositoryUtil.addPortletRepository(getGroupId(),
            WikiConstants.SERVICE_NAME, serviceContext);

    WikiNode node = getNode();

    Folder nodeFolder = node.addAttachmentsFolder();

    Folder folder = PortletFileRepositoryUtil.addPortletFolder(getUserId(), repository.getRepositoryId(),
            nodeFolder.getFolderId(), String.valueOf(getResourcePrimKey()), serviceContext);

    _attachmentsFolderId = folder.getFolderId();

    return folder;
}

From source file:com.liferay.wiki.util.WikiPageAttachmentsUtil.java

License:Open Source License

public static WikiPage getPage(long fileEntryId) throws PortalException {
    FileEntry fileEntry = PortletFileRepositoryUtil.getPortletFileEntry(fileEntryId);

    Folder folder = PortletFileRepositoryUtil.getPortletFolder(fileEntry.getFolderId());

    long resourcePrimKey = GetterUtil.getLong(folder.getName());

    return WikiPageLocalServiceUtil.getPage(resourcePrimKey);
}