List of usage examples for com.liferay.portal.kernel.service ServiceContext setAddGroupPermissions
public void setAddGroupPermissions(boolean addGroupPermissions)
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 ava 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.bemis.portal.report.model.impl.ReportRequestImpl.java
License:Open Source License
@Override public long getAttachmentsFolderId() { if (_attachmentsFolderId != DLFolderConstants.DEFAULT_PARENT_FOLDER_ID) { return _attachmentsFolderId; }/*from ww w . jav a 2s . com*/ 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.asset.categories.admin.web.internal.exportimport.data.handler.AssetCategoryStagedModelDataHandler.java
License:Open Source License
protected ServiceContext createServiceContext(PortletDataContext portletDataContext, AssetCategory category) { ServiceContext serviceContext = new ServiceContext(); serviceContext.setAddGroupPermissions(true); serviceContext.setAddGuestPermissions(true); serviceContext.setCreateDate(category.getCreateDate()); serviceContext.setModifiedDate(category.getModifiedDate()); serviceContext.setScopeGroupId(portletDataContext.getScopeGroupId()); return serviceContext; }
From source file:com.liferay.asset.categories.admin.web.internal.exportimport.data.handler.AssetVocabularyStagedModelDataHandler.java
License:Open Source License
protected ServiceContext createServiceContext(PortletDataContext portletDataContext, AssetVocabulary vocabulary) {/*from w w w . j a va 2 s .c o m*/ ServiceContext serviceContext = new ServiceContext(); serviceContext.setAddGroupPermissions(true); serviceContext.setAddGuestPermissions(true); serviceContext.setCreateDate(vocabulary.getCreateDate()); serviceContext.setModifiedDate(vocabulary.getModifiedDate()); serviceContext.setScopeGroupId(portletDataContext.getScopeGroupId()); return serviceContext; }
From source file:com.liferay.asset.publisher.service.test.AssetPublisherServiceTest.java
License:Open Source License
protected void addAssetVocabulary() throws Exception { ServiceContext serviceContext = ServiceContextTestUtil.getServiceContext(_group.getGroupId()); serviceContext.setAddGroupPermissions(false); serviceContext.setAddGuestPermissions(false); AssetVocabulary assetVocabulary = AssetVocabularyLocalServiceUtil.addVocabulary(TestPropsValues.getUserId(), _group.getGroupId(), RandomTestUtil.randomString(), serviceContext); addAssetCategories(assetVocabulary.getVocabularyId()); }
From source file:com.liferay.asset.search.test.JournalArticleFixture.java
License:Open Source License
public ServiceContext createServiceContext() throws PortalException { ServiceContext serviceContext = ServiceContextTestUtil.getServiceContext(_group.getGroupId(), TestPropsValues.getUserId()); serviceContext.setAddGuestPermissions(false); serviceContext.setAddGroupPermissions(false); return serviceContext; }
From source file:com.liferay.asset.tags.internal.exportimport.data.handler.AssetTagStagedModelDataHandler.java
License:Open Source License
protected ServiceContext createServiceContext(PortletDataContext portletDataContext, AssetTag assetTag) { ServiceContext serviceContext = new ServiceContext(); serviceContext.setAddGroupPermissions(true); serviceContext.setAddGuestPermissions(true); serviceContext.setCreateDate(assetTag.getCreateDate()); serviceContext.setModifiedDate(assetTag.getModifiedDate()); serviceContext.setScopeGroupId(portletDataContext.getScopeGroupId()); return serviceContext; }
From source file:com.liferay.blogs.demo.data.creator.internal.BaseBlogsEntryDemoDataCreator.java
License:Open Source License
public BlogsEntry createBlogsEntry(long userId, long groupId, String title, String subtitle, String content) throws IOException, PortalException { ServiceContext serviceContext = new ServiceContext(); serviceContext.setAddGroupPermissions(true); serviceContext.setAddGuestPermissions(true); serviceContext.setScopeGroupId(groupId); ImageSelector imageSelector = new ImageSelector(_getRandomImageBytes(userId, groupId), StringUtil.randomString() + ".jpeg", "image/jpeg", StringPool.BLANK); BlogsEntry blogsEntry = blogsEntryLocalService.addEntry(userId, title, subtitle, null, content, _getRandomDate(), false, false, null, null, imageSelector, null, serviceContext); entryIds.add(blogsEntry.getEntryId()); return blogsEntry; }
From source file:com.liferay.blogs.internal.atom.BlogsEntryAtomCollectionAdapter.java
License:Open Source License
@Override protected BlogsEntry doPostEntry(String title, String summary, String content, Date date, AtomRequestContext atomRequestContext) throws Exception { long groupId = atomRequestContext.getLongParameter("groupId"); Calendar cal = Calendar.getInstance(); cal.setTime(date);//from w w w . j a va 2s.c o m int displayDateMonth = cal.get(Calendar.MONTH); int displayDateDay = cal.get(Calendar.DAY_OF_MONTH); int displayDateYear = cal.get(Calendar.YEAR); int displayDateHour = cal.get(Calendar.HOUR_OF_DAY); int displayDateMinute = cal.get(Calendar.MINUTE); boolean allowPingbacks = true; boolean allowTrackbacks = true; String[] trackbacks = new String[0]; ServiceContext serviceContext = new ServiceContext(); serviceContext.setAddGroupPermissions(true); serviceContext.setAddGuestPermissions(true); serviceContext.setScopeGroupId(groupId); return _blogsEntryService.addEntry(title, StringPool.BLANK, summary, content, displayDateMonth, displayDateDay, displayDateYear, displayDateHour, displayDateMinute, allowPingbacks, allowTrackbacks, trackbacks, StringPool.BLANK, null, null, serviceContext); }
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 {/*from w w w.j a v a 2s . c o m*/ Folder folder = PortletFileRepositoryUtil.getPortletFolder(repository.getRepositoryId(), DLFolderConstants.DEFAULT_PARENT_FOLDER_ID, BlogsConstants.SERVICE_NAME); return folder; } catch (Exception e) { } return null; }