Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import com.liferay.portal.kernel.util.StringPool;
- import com.liferay.portal.model.User;
- import com.liferay.portal.service.ServiceContext;
- import com.liferay.portal.service.UserLocalServiceUtil;
- import com.liferay.portal.util.PortalInstances;
- int startUserId = 100;
- int maxUserCount = 400;
- User user = null;
- ServiceContext serviceContext = new ServiceContext();
- long creatorUserId = 0;
- long companyId = PortalInstances.getDefaultCompanyId();
- boolean autoPassword = false;
- String password1 = "perf";
- String password2 = "perf";
- boolean autoScreenName = false;
- String screenName = "perf";
- String emailAddress = "perf@liferay.com";
- long facebookId = 0;
- String openId = com.liferay.portal.kernel.util.StringPool.BLANK;
- Locale locale = Locale.US;
- String firstName = "PERF";
- String middleName = com.liferay.portal.kernel.util.StringPool.BLANK;
- String lastName = "USER";
- int prefixId = 0;
- int suffixId = 0;
- boolean male = true;
- int birthdayMonth = Calendar.JANUARY;
- int birthdayDay = 1;
- int birthdayYear = 1970;
- String jobTitle = StringPool.BLANK;
- long[] groupIds = null;
- long[] organizationIds = null;
- long[] roleIds = null;
- long[] userGroupIds = null;
- boolean sendEmail = false;
- for (int ui = startUserId; ui < startUserId + maxUserCount; ++ui) {
- screenName = "perf"+ui;
- try { user = UserLocalServiceUtil.getUserByScreenName(companyId, screenName); } catch (Exception e) {user = null;}
- if (user == null) {
- emailAddress = screenName + "@liferay.com";
- try {
- 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);
- } catch(Exception e) {}
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement