本文整理汇总了Java中com.liferay.portal.theme.ThemeDisplay.getCompanyId方法的典型用法代码示例。如果您正苦于以下问题:Java ThemeDisplay.getCompanyId方法的具体用法?Java ThemeDisplay.getCompanyId怎么用?Java ThemeDisplay.getCompanyId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.liferay.portal.theme.ThemeDisplay
的用法示例。
在下文中一共展示了ThemeDisplay.getCompanyId方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: deleteExportedCourse
import com.liferay.portal.theme.ThemeDisplay; //导入方法依赖的package包/类
public void deleteExportedCourse(ActionRequest actionRequest, ActionResponse actionResponse) throws IOException {
ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY);
long groupId = ParamUtil.getLong(actionRequest, "groupId", 0);
String fileName = ParamUtil.getString(actionRequest, "fileName", StringPool.BLANK);
String redirect = ParamUtil.getString(actionRequest, "redirect", StringPool.BLANK);
File f = new File(PropsUtil.get("liferay.home")+"/data/lms_exports/courses/"+themeDisplay.getCompanyId()+"/"+groupId+"/"+fileName);
if (themeDisplay.getPermissionChecker().hasPermission(groupId, Course.class.getName(), groupId, ActionKeys.DELETE) && f != null && f.isFile()) {
FileUtil.delete(f);
SessionMessages.add(actionRequest, "courseadmin.delete.exported.confirmation.success");
} else {
SessionMessages.add(actionRequest, "courseadmin.delete.exported.confirmation.error");
}
if (Validator.isNotNull(redirect)) {
actionResponse.sendRedirect(redirect);
}
}
示例2: addUser
import com.liferay.portal.theme.ThemeDisplay; //导入方法依赖的package包/类
private User addUser(final ActionRequest request, String screenName,
String password, String repassword, Date birthdate,
String fullName, String email, int gender) throws PortalException,
SystemException {
ThemeDisplay themeDisplay = (ThemeDisplay) request
.getAttribute(WebKeys.THEME_DISPLAY);
long creatorUserId = themeDisplay.getUserId(); // default liferay user
long companyId = themeDisplay.getCompanyId(); // default company
boolean autoPassword = true;
String password1 = "";
String password2 = "";
boolean autoScreenName = true;
String emailAddress = email;
long facebookId = 0;
String openId = "";
Locale locale = themeDisplay.getLocale();
String[] tg = fullName.split(" ");
String firstName = tg[0];
String middleName = "";
String lastName = "";
if (tg.length > 1) {
firstName = tg[tg.length - 1];
lastName = tg[0];
}
if (tg.length > 2) {
middleName = tg[1];
for (int i = 2; i < tg.length - 1; i++) {
middleName += " " + tg[i];
}
}
int prefixId = 0;
int suffixId = 0;
boolean male = gender == 1;
Calendar birthday = CalendarFactoryUtil.getCalendar();
birthday.setTime(birthdate);
int birthdayMonth = birthday.get(Calendar.MONTH);
int birthdayDay = birthday.get(Calendar.DAY_OF_MONTH);
int birthdayYear = birthday.get(Calendar.YEAR);
String jobTitle = "";
long[] groupIds = null;
long[] organizationIds = null;
long[] roleIds = null;
long[] userGroupIds = null;
boolean sendEmail = false;
ServiceContext serviceContext = ServiceContextFactory
.getInstance(request);
try {
User user = UserLocalServiceUtil.addUser(creatorUserId, companyId,
autoPassword, password1, password2, autoScreenName, screenName,
emailAddress, facebookId, openId, locale, firstName,
middleName, lastName, prefixId, suffixId, male, birthdayMonth,
birthdayDay, birthdayYear, jobTitle, groupIds, organizationIds,
roleIds, userGroupIds, sendEmail, serviceContext);
return user;
} catch(Exception e){
System.out.println(e.getMessage());
return null;
}
}
示例3: getCompanyId
import com.liferay.portal.theme.ThemeDisplay; //导入方法依赖的package包/类
/**
* Gets the company id.
*
* @param request the request
* @return the company id
*/
protected Long getCompanyId(final PortletRequest request) {
final ThemeDisplay themeDisplay = (ThemeDisplay) request
.getAttribute(WebKeys.THEME_DISPLAY);
return themeDisplay.getCompanyId();
}