| | |
| | |
|
| | | /**
|
| | | * Utility class for building activity information from repositories.
|
| | | * |
| | | *
|
| | | * @author James Moger
|
| | | * |
| | | *
|
| | | */
|
| | | public class ActivityUtils {
|
| | |
|
| | | /**
|
| | | * Gets the recent activity from the repositories for the last daysBack days
|
| | | * on the specified branch.
|
| | | * |
| | | *
|
| | | * @param models
|
| | | * the list of repositories to query
|
| | | * @param daysBack
|
| | |
| | | df.setTimeZone(timezone);
|
| | | Calendar cal = Calendar.getInstance();
|
| | | cal.setTimeZone(timezone);
|
| | | |
| | |
|
| | | // aggregate author exclusions
|
| | | Set<String> authorExclusions = new TreeSet<String>();
|
| | | authorExclusions.addAll(GitBlit.getStrings(Keys.web.metricAuthorExclusions));
|
| | |
| | | // trim commits to maximum count
|
| | | commits = commits.subList(0, model.maxActivityCommits);
|
| | | }
|
| | | for (RepositoryCommit commit : commits) { |
| | | for (RepositoryCommit commit : commits) {
|
| | | Date date = commit.getCommitDate();
|
| | | String dateStr = df.format(date);
|
| | | if (!activity.containsKey(dateStr)) {
|
| | |
| | | activity.get(dateStr).addCommit(commit);
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | // close the repository
|
| | | repository.close();
|
| | | }
|
| | |
| | | /**
|
| | | * Returns the Gravatar profile, if available, for the specified email
|
| | | * address.
|
| | | * |
| | | *
|
| | | * @param emailaddress
|
| | | * @return a Gravatar Profile
|
| | | * @throws IOException
|
| | |
| | |
|
| | | /**
|
| | | * Creates a Gravatar thumbnail url from the specified email address.
|
| | | * |
| | | *
|
| | | * @param email
|
| | | * address to query Gravatar
|
| | | * @param width
|
| | |
| | | "https://www.gravatar.com/avatar/{0}?s={1,number,0}&d=identicon", emailHash, width);
|
| | | return url;
|
| | | }
|
| | | |
| | |
|
| | | /**
|
| | | * Creates a Gravatar thumbnail url from the specified email address.
|
| | | * |
| | | *
|
| | | * @param email
|
| | | * address to query Gravatar
|
| | | * @param width
|
| | |
| | | /**
|
| | | * Returns the Gravatar profile, if available, for the specified hashcode.
|
| | | * address.
|
| | | * |
| | | *
|
| | | * @param hash
|
| | | * the hash of the email address
|
| | | * @return a Gravatar Profile
|