Esempio n. 1
0
  public void addUser(
      long companyId,
      long userId,
      String password,
      String firstName,
      String middleName,
      String lastName,
      String emailAddress) {

    try {
      String nickname = _getNickname(emailAddress);

      GUserManager gUserManager = GoogleAppsFactoryUtil.getGUserManager(companyId);

      gUserManager.addGUser(userId, password, firstName, lastName);

      GNicknameManager gNicknameManager = GoogleAppsFactoryUtil.getGNicknameManager(companyId);

      gNicknameManager.addGNickname(userId, nickname);

      GEmailSettingsManager gEmailSettingsManager =
          GoogleAppsFactoryUtil.getGEmailSettingsManager(companyId);

      FullNameGenerator fullNameGenerator = FullNameGeneratorFactory.getInstance();

      gEmailSettingsManager.addSendAs(
          userId, fullNameGenerator.getFullName(firstName, middleName, lastName), emailAddress);
    } catch (Exception e) {
      _log.error(e, e);
    }
  }
Esempio n. 2
0
  public void deleteEmailAddress(long companyId, long userId) {
    try {
      User user = UserLocalServiceUtil.getUserById(userId);

      String nickname = _getNickname(user.getEmailAddress());

      GNicknameManager gNicknameManager = GoogleAppsFactoryUtil.getGNicknameManager(companyId);

      gNicknameManager.deleteGNickname(nickname);
    } catch (Exception e) {
      _log.error(e, e);
    }
  }
Esempio n. 3
0
  public void updateEmailAddress(long companyId, long userId, String emailAddress) {

    try {
      User user = UserLocalServiceUtil.getUserById(userId);

      deleteEmailAddress(companyId, userId);

      GNicknameManager gNicknameManager = GoogleAppsFactoryUtil.getGNicknameManager(companyId);

      gNicknameManager.addGNickname(userId, emailAddress);

      GEmailSettingsManager gEmailSettingsManager =
          GoogleAppsFactoryUtil.getGEmailSettingsManager(companyId);

      gEmailSettingsManager.addSendAs(userId, user.getFullName(), emailAddress);
    } catch (Exception e) {
      _log.error(e, e);
    }
  }