private List<Git.Remote> getRemotes(final Repository repository) { Config config = repository.getConfig(); List<Git.Remote> remotes = new ArrayList<Git.Remote>(); for (String remote : config.getSubsections("remote")) { String url = config.getString("remote", remote, "url"); remotes.add(new Git.Remote(remote, url)); } return remotes; }
@Override public ServiceUserInfo apply(ServiceUserResource rsrc) throws ResourceNotFoundException, OrmException { ProjectLevelConfig storage = projectCache.getAllProjects().getConfig(pluginName + ".db"); String username = rsrc.getUser().getUserName(); Config db = storage.get(); if (!db.getSubsections(USER).contains(username)) { throw new ResourceNotFoundException(username); } ServiceUserInfo info = new ServiceUserInfo(getAccount.get().apply(rsrc)); AccountLoader al = accountLoader.create(true); info.createdBy = al.get(new Account.Id(db.getInt(USER, username, KEY_CREATOR_ID, -1))); al.fill(); info.createdAt = db.getString(USER, username, KEY_CREATED_AT); info.inactive = !rsrc.getUser().getAccount().isActive() ? true : null; Response<GroupInfo> response = getOwner.apply(rsrc); if (response.statusCode() == SC_OK) { info.owner = response.value(); } return info; }