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


Java PortalUtil.getDefaultCompanyId方法代码示例

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


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

示例1: _notityMail

import com.liferay.portal.util.PortalUtil; //导入方法依赖的package包/类
private void _notityMail(String context, Throwable e) {

		try {
			String errorMailTo =
				PrefsPropsUtil.getString(
					PortletPropsKeys.MQTT_ERRORS_SEND_MAIL_TO,
					PortletPropsValues.MQTT_ERRORS_SEND_MAIL_TO);

			if (Validator.isNotNull(errorMailTo)) {
				MailMessage mailMessage = new MailMessage();

				long companyId = PortalUtil.getDefaultCompanyId();

				String fromAddress = PrefsPropsUtil.getString(
					companyId, PropsKeys.ADMIN_EMAIL_FROM_ADDRESS);

				mailMessage.setHTMLFormat(false);
				mailMessage.setTo(new InternetAddress(errorMailTo));
				mailMessage.setSubject(String.format(
					"%s Mqtt connector error", PortalUtil.getComputerName()));
				mailMessage.setFrom(new InternetAddress(fromAddress));

				StringWriter sw = new StringWriter();
				PrintWriter pw = new PrintWriter(sw);
				e.printStackTrace(pw);

				mailMessage.setBody(String.format(
					"context: %s\nerror: %s\n stacktrace:%s\n", context,
					e.getMessage(), sw.toString()));

				MailServiceUtil.sendEmail(mailMessage);
			}
		}
		catch (Exception e1) {
			_log.error(e1);
		}
	}
 
开发者ID:baxtheman,项目名称:mqtt-liferay-plugins,代码行数:38,代码来源:MqttLocalServiceImpl.java

示例2: createCourse

import com.liferay.portal.util.PortalUtil; //导入方法依赖的package包/类
@JSONWebService
public Course createCourse(long groupId,String title, String description,boolean published,String summary,int evaluationmethod,int calificationType,int template,int registermethod,int maxusers, Date startregistrationdate,Date endregistrationdate) throws PortalException, SystemException
{
	User user=getUser();
	
	java.util.Date ahora=new java.util.Date(System.currentTimeMillis());
	ServiceContext serviceContext = ServiceContextThreadLocal.getServiceContext();
	serviceContext.setUserId(user.getUserId());
	serviceContext.setScopeGroupId(groupId);
	String groupName = GroupConstants.GUEST;
	long companyId = PortalUtil.getDefaultCompanyId();
	
	if( getPermissionChecker().hasPermission(groupId, "com.liferay.lms.coursemodel",groupId,"ADD_COURSE"))
	{
		Course course = com.liferay.lms.service.CourseLocalServiceUtil.addCourse(
				title, description, summary, StringPool.BLANK,
				user.getLocale(), ahora, startregistrationdate, endregistrationdate,template,registermethod,evaluationmethod,
				calificationType,maxusers,serviceContext,false);
		com.liferay.lms.service.CourseLocalServiceUtil.setVisible(course.getCourseId(), published);
		return course;
	}
	else
	{
		return null;
	}
}
 
开发者ID:TelefonicaED,项目名称:liferaylms-portlet,代码行数:27,代码来源:CourseServiceImpl.java

示例3: receive

import com.liferay.portal.util.PortalUtil; //导入方法依赖的package包/类
@Override
public void receive(Message message) throws MessageListenerException {
	// TODO Auto-generated method stub
	System.out.println("ProcessScheduler processing");
	long companyId = PortalUtil.getDefaultCompanyId();
	System.out.println("Company Id: " + companyId);
}
 
开发者ID:openegovplatform,项目名称:OEPv2,代码行数:8,代码来源:ProcessScheduler.java

示例4: getCourses

import com.liferay.portal.util.PortalUtil; //导入方法依赖的package包/类
@JSONWebService
public java.util.List<Course> getCourses() throws SystemException, PortalException
{
	String groupName = GroupConstants.GUEST;
	 long companyId = PortalUtil.getDefaultCompanyId();
	 long guestGroupId = GroupLocalServiceUtil.getGroup(companyId, groupName).getGroupId();
	 return coursePersistence.filterFindByGroupId(guestGroupId);
		
	
}
 
开发者ID:TelefonicaED,项目名称:liferaylms-portlet,代码行数:11,代码来源:CourseServiceImpl.java


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