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


Java ThemeDisplay.getLocale方法代码示例

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


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

示例1: 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;
	}
	
}
 
开发者ID:openegovplatform,项目名称:OEPv2,代码行数:66,代码来源:EmpLoyeePortlet.java


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