Example #1
0
  /**
   * Method description
   *
   * @param user
   */
  private void encryptPassword(User user) {
    String password = user.getPassword();

    if (Util.isNotEmpty(password)) {
      user.setPassword(encryptionHandler.encrypt(password));
    }
  }
Example #2
0
  /**
   * Method description
   *
   * @param users
   * @return
   */
  @Override
  protected Collection<User> prepareForReturn(Collection<User> users) {
    if (Util.isNotEmpty(users)) {
      for (User u : users) {
        u.setPassword(DUMMY_PASSWORT);
      }
    }

    return users;
  }
  /**
   * //~--- methods --------------------------------------------------------------
   *
   * <p>Method description
   *
   * @param content
   * @return
   */
  public static Map<String, SubRepository> parse(String content) {
    Map<String, SubRepository> subRepositories = new HashMap<String, SubRepository>();
    Scanner scanner = new Scanner(content);
    SubRepository repository = null;

    while (scanner.hasNextLine()) {
      String line = scanner.nextLine();

      if (Util.isNotEmpty(line)) {
        line = line.trim();

        if (line.startsWith("[") && line.endsWith("]")) {
          repository = new SubRepository();
        } else if (line.startsWith("path")) {
          subRepositories.put(getValue(line), repository);
        } else if (line.startsWith("url")) {
          repository.setRepositoryUrl(getValue(line));
        }
      }
    }

    return subRepositories;
  }