当前位置: 首页>>代码示例>>Java>>正文


Java ServiceContext.setScopeGroupId方法代码示例

本文整理汇总了Java中com.liferay.portal.kernel.service.ServiceContext.setScopeGroupId方法的典型用法代码示例。如果您正苦于以下问题:Java ServiceContext.setScopeGroupId方法的具体用法?Java ServiceContext.setScopeGroupId怎么用?Java ServiceContext.setScopeGroupId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.liferay.portal.kernel.service.ServiceContext的用法示例。


在下文中一共展示了ServiceContext.setScopeGroupId方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: _addJournalArticle

import com.liferay.portal.kernel.service.ServiceContext; //导入方法依赖的package包/类
private JournalArticle _addJournalArticle(
	Long groupId, WebPageElementCreatorForm webPageElementCreatorForm) {

	ServiceContext serviceContext = new ServiceContext();

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

	Try<JournalArticle> journalArticleTry = Try.fromFallible(() ->
		_journalArticleService.addArticle(
			groupId, webPageElementCreatorForm.getFolder(), 0, 0, null,
			true, webPageElementCreatorForm.getTitleMap(),
			webPageElementCreatorForm.getDescriptionMap(),
			webPageElementCreatorForm.getText(),
			webPageElementCreatorForm.getStructure(),
			webPageElementCreatorForm.getTemplate(), null,
			webPageElementCreatorForm.getDisplayDateMonth(),
			webPageElementCreatorForm.getDisplayDateDay(),
			webPageElementCreatorForm.getDisplayDateYear(),
			webPageElementCreatorForm.getDisplayDateHour(),
			webPageElementCreatorForm.getDisplayDateMinute(), 0, 0, 0, 0, 0,
			true, 0, 0, 0, 0, 0, true, true, null, serviceContext));

	return journalArticleTry.getUnchecked();
}
 
开发者ID:liferay,项目名称:com-liferay-apio-architect,代码行数:27,代码来源:WebPageElementNestedCollectionResource.java

示例2: _updateJournalArticle

import com.liferay.portal.kernel.service.ServiceContext; //导入方法依赖的package包/类
private JournalArticle _updateJournalArticle(
	Long journalArticleId,
	WebPageElementUpdaterForm webPageElementUpdaterForm) {

	ServiceContext serviceContext = new ServiceContext();

	serviceContext.setAddGroupPermissions(true);
	serviceContext.setAddGuestPermissions(true);
	serviceContext.setScopeGroupId(webPageElementUpdaterForm.getGroup());

	Try<JournalArticle> journalArticleTry = Try.fromFallible(() ->
		_journalArticleService.updateArticle(
			webPageElementUpdaterForm.getUser(),
			webPageElementUpdaterForm.getGroup(),
			webPageElementUpdaterForm.getFolder(),
			String.valueOf(journalArticleId),
			webPageElementUpdaterForm.getVersion(),
			webPageElementUpdaterForm.getTitleMap(),
			webPageElementUpdaterForm.getDescriptionMap(),
			webPageElementUpdaterForm.getText(), null, serviceContext));

	return journalArticleTry.getUnchecked();
}
 
开发者ID:liferay,项目名称:com-liferay-apio-architect,代码行数:24,代码来源:WebPageElementNestedCollectionResource.java

示例3: _addBlogsEntry

import com.liferay.portal.kernel.service.ServiceContext; //导入方法依赖的package包/类
private BlogsEntry _addBlogsEntry(
	Long groupId, BlogPostingForm blogPostingForm) {

	ServiceContext serviceContext = new ServiceContext();

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

	Try<BlogsEntry> blogsEntryTry = Try.fromFallible(
		() -> _blogsService.addEntry(
			blogPostingForm.getHeadline(),
			blogPostingForm.getAlternativeHeadline(),
			blogPostingForm.getDescription(),
			blogPostingForm.getArticleBody(),
			blogPostingForm.getDisplayDateMonth(),
			blogPostingForm.getDisplayDateDay(),
			blogPostingForm.getDisplayDateYear(),
			blogPostingForm.getDisplayDateHour(),
			blogPostingForm.getDisplayDateMinute(), false, false, null,
			null, null, null, serviceContext));

	return blogsEntryTry.getUnchecked();
}
 
开发者ID:liferay,项目名称:com-liferay-apio-architect,代码行数:25,代码来源:BlogPostingNestedCollectionResource.java

示例4: _updateBlogsEntry

import com.liferay.portal.kernel.service.ServiceContext; //导入方法依赖的package包/类
private BlogsEntry _updateBlogsEntry(
	Long blogsEntryId, BlogPostingForm blogPostingForm) {

	ServiceContext serviceContext = new ServiceContext();

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

	BlogsEntry blogsEntry = _getBlogsEntry(blogsEntryId);

	serviceContext.setScopeGroupId(blogsEntry.getGroupId());

	Try<BlogsEntry> blogsEntryTry = Try.fromFallible(
		() -> _blogsService.updateEntry(
			blogsEntryId, blogPostingForm.getHeadline(),
			blogPostingForm.getAlternativeHeadline(),
			blogPostingForm.getDescription(),
			blogPostingForm.getArticleBody(),
			blogPostingForm.getDisplayDateMonth(),
			blogPostingForm.getDisplayDateDay(),
			blogPostingForm.getDisplayDateYear(),
			blogPostingForm.getDisplayDateHour(),
			blogPostingForm.getDisplayDateMinute(), false, false, null,
			null, null, null, serviceContext));

	return blogsEntryTry.getUnchecked();
}
 
开发者ID:liferay,项目名称:com-liferay-apio-architect,代码行数:28,代码来源:BlogPostingNestedCollectionResource.java

示例5: notificationByType

import com.liferay.portal.kernel.service.ServiceContext; //导入方法依赖的package包/类
public static void notificationByType(String[] notificationTypeList) {

		List<NotificationQueue> listQueue = NotificationQueueLocalServiceUtil.getNotificationQueues(QueryUtil.ALL_POS,
				QueryUtil.ALL_POS);

		ServiceContext serviceContext = new ServiceContext();

		for (NotificationQueue notificationQueue : listQueue) {
			
			serviceContext.setCompanyId(notificationQueue.getCompanyId());
			serviceContext.setUserId(notificationQueue.getUserId());
			serviceContext.setScopeGroupId(notificationQueue.getGroupId());
			
			long groupId = notificationQueue.getGroupId();

			String queueType = notificationQueue.getNotificationType();

			try {

				JSONObject payLoadData = JSONFactoryUtil.createJSONObject(notificationQueue.getPayload());

				for (String type : notificationTypeList) {

					if (queueType.equals(type)) {

						Notificationtemplate notificationtemplate = NotificationtemplateLocalServiceUtil
								.fetchByF_NotificationtemplateByType(groupId, type);

						JSONObject payLoad = JSONFactoryUtil.createJSONObject();

						payLoad.put("toName", payLoadData.get("toName") );
						payLoad.put("toAddress", payLoadData.get("toAddress"));
						payLoad.put("subject", payLoadData.get("subject"));
						payLoad.put("body", payLoadData.get("body") );
						
//								StringUtil.replace(notificationtemplate.getEmailBody(),
//										new String[] { "[$USERNAME$]", "[$USEREMAIL$]", "[$PASSWORD$]", "[$PASSWORD_CODE$]", "[$USERSTATUS$]" },
//										new String[] { payLoadData.getString("USERNAME"),
//												payLoadData.getString("toName"),
//												payLoadData.getString("PASSWORD"),
//												payLoadData.getString("PASSWORD_CODE"),
//												payLoadData.getString("USERSTATUS") }));

						SendMailUtils.sendEmailNotification(payLoad, serviceContext);

						try {
							NotificationQueueLocalServiceUtil.deleteNotificationQueue(
									notificationQueue.getNotificationQueueId(), serviceContext);
						} catch (NoSuchNotificationQueueException e) {
							// TODO Auto-generated catch block
							e.printStackTrace();
						}

					}

				}

			} catch (JSONException e1) {
				// TODO Auto-generated catch block
				e1.printStackTrace();
			}

		}

	}
 
开发者ID:VietOpenCPS,项目名称:opencps-v2,代码行数:66,代码来源:SchedulerUtilProcessing.java


注:本文中的com.liferay.portal.kernel.service.ServiceContext.setScopeGroupId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。