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

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

Introduction

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

Prototype

public static Repository addPortletRepository(long groupId, String portletId, 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   w ww.ja  v a 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 w  w 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 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  2  s.c  om*/

    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 Folder addImagesFolder() throws PortalException {
    if (_imagesFolderId != DLFolderConstants.DEFAULT_PARENT_FOLDER_ID) {
        return PortletFileRepositoryUtil.getPortletFolder(_imagesFolderId);
    }//www  .  jav a 2  s .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  w w  w  .  ja  v a 2  s. com

    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 2 s . 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;
}