Пример #1
0
 public Map<String, String> getAllUsers() {
   Config pwdConfig = new Config("user");
   TreeMap<String, String> users = new TreeMap<>();
   String suffix = ".password";
   for (String user : pwdConfig.listKeys()) {
     if (user.endsWith(suffix)) {
       String name = user.substring(0, user.length() - suffix.length());
       users.put(name.trim(), pwdConfig.getString(user).trim());
     }
   }
   return users;
 }
Пример #2
0
  @Override
  public synchronized void readUsers() {
    for (String userPropertyKey : config.listKeys()) {
      UserProperty property = new UserProperty(userPropertyKey, config.getString(userPropertyKey));

      UserModel user = getUser(property.getUsername());

      if (user == null) user = new UserModel(property.getUsername());

      PropertyMapper mapper = new PropertyMapper<UserModel>(user);

      mapper.map(property.getPropertyName(), property.getPropertyValue());

      users.put(user.getUserName(), user);
    }
  }