本文整理汇总了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);
}
}
示例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;
}
}
示例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);
}
示例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);
}