User user = UserLocalManagerUtil.addUser(
companyId, true, StringPool.BLANK, false, "test", "test", false,
"Test", StringPool.BLANK, "Test", StringPool.BLANK, true, now,
"test@" + company.getMx(), defaultUser.getLocale());
Role adminRole;
try {
adminRole = APILocator.getRoleAPI().loadRoleByKey("Administrator");
} catch (DotDataException e) {
Logger.error(CompanyLocalManagerImpl.class,e.getMessage(),e);
throw new SystemException(e);
}
String[] roleIds = new String[] {adminRole.getId()};
for (String roleId : roleIds) {
try {
APILocator.getRoleAPI().addRoleToUser(roleId, user);
} catch (DotStateException e) {