天天看點

添加liferay 使用者

com.liferay.portal.model.User
private void writeUserInfo(Prebills prebills,User user) {
		String screenName = "aa";

		ServiceContext serviceContext = new ServiceContext();
		Locale locale = user.getLocale();
		int birthdayMonth = Calendar.JANUARY;
		int birthdayDay = 1;
		int birthdayYear = 1970;
		try{
			User liferayUser = UserLocalServiceUtil.addUser(user.getUserId(), user.getCompanyId(), true,null, null, false, screenName, "[email protected]",StringPool.BLANK, locale, "surname", "","givName", 0, 0, true, birthdayMonth,
birthdayDay, birthdayYear, StringPool.BLANK, null, null, null,
null, false, serviceContext);

	UserInfo shipper_User = new UserInfo();
			shipper_User.setUserId(java.util.UUID.randomUUID().toString());
			shipper_User.setPwd(liferayUser.getPassword());
			shipper_User.setSurname("surName");
			shipper_User.setGivenName("givName");
			shipper_User.setStartDate(new Date());
			shipper_User.setUserStatus("status");
			shipper_User.setIsServiceCentreAccount("N");
			shipper_User.setCreatedBy(user.getUuid());
			shipper_User.setCreatedDate(new Date());

			PortletActionBeanProxy.getInstance().
				getUserInfoSvc().createUserInfo(shipper_User);
		}catch(Exception e){
			e.printStackTrace();
		}
	}