예제 #1
0
  public static long getGroupId(long companyId, String[] pathArray) throws WebDAVException {

    try {
      if (pathArray.length == 0) {
        return 0;
      }

      String name = pathArray[0];

      Group group = GroupLocalServiceUtil.fetchFriendlyURLGroup(companyId, StringPool.SLASH + name);

      if (group != null) {
        return group.getGroupId();
      }

      User user = UserLocalServiceUtil.fetchUserByScreenName(companyId, name);

      if (user != null) {
        group = user.getGroup();

        return group.getGroupId();
      }
    } catch (Exception e) {
      throw new WebDAVException(e);
    }

    return 0;
  }
  protected long getUserId(
      long userId, WikiNode node, String author, Map<String, String> usersMap) {

    User user = null;

    String emailAddress = usersMap.get(author);

    if (Validator.isNotNull(emailAddress)) {
      user = UserLocalServiceUtil.fetchUserByEmailAddress(node.getCompanyId(), emailAddress);
    } else {
      user =
          UserLocalServiceUtil.fetchUserByScreenName(
              node.getCompanyId(), StringUtil.toLowerCase(author));
    }

    if (user != null) {
      return user.getUserId();
    }

    return userId;
  }