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

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

Introduction

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

Prototype

public static Folder addPortletFolder(long userId, long repositoryId, long parentFolderId, String folderName,
            ServiceContext serviceContext) 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);
    }/*from  www .  j  a  va  2 s  .  c o  m*/

    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.blogs.service.impl.BlogsEntryLocalServiceImpl.java

License:Open Source License

protected Folder doAddFolder(long userId, long groupId, String folderName) throws PortalException {

    ServiceContext serviceContext = new ServiceContext();

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

    Repository repository = PortletFileRepositoryUtil.addPortletRepository(groupId, BlogsConstants.SERVICE_NAME,
            serviceContext);//from  ww  w .j  a v  a  2  s.  c om

    Folder folder = PortletFileRepositoryUtil.addPortletFolder(userId, repository.getRepositoryId(),
            DLFolderConstants.DEFAULT_PARENT_FOLDER_ID, folderName, serviceContext);

    return folder;
}

From source file:com.liferay.journal.internal.upgrade.v1_1_0.UpgradeImageTypeContent.java

License:Open Source License

protected long getFolderId(long userId, long groupId, long resourcePrimKey) throws PortalException {

    long repositoryId = getRepositoryId(groupId);

    try {/*from   w w w  .j a  va 2 s.  co  m*/
        Folder folder = PortletFileRepositoryUtil.getPortletFolder(repositoryId,
                DLFolderConstants.DEFAULT_PARENT_FOLDER_ID, String.valueOf(resourcePrimKey));

        return folder.getFolderId();
    } catch (NoSuchFolderException nsfe) {
    }

    ServiceContext serviceContext = new ServiceContext();

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

    Folder folder = PortletFileRepositoryUtil.addPortletFolder(userId, repositoryId,
            DLFolderConstants.DEFAULT_PARENT_FOLDER_ID, String.valueOf(resourcePrimKey), serviceContext);

    return folder.getFolderId();
}

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);
    }/*from  w  w  w.ja va2s.  com*/

    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 ww  w.  ja v a2s. co 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 ww. j av  a  2s  . c  o  m*/

    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;
}