@Override public IssueHistory next() { Issue nextIssue = issues.next(); List<ChangeHistory> nextChangeHistories = changeHistoryManager.getChangeHistoriesForUser(nextIssue, remoteUser); return new IssueHistory(nextIssue, ImmutableList.copyOf(nextChangeHistories)); }
private Multimap<Issue, ChangeHistory> doGetChangeHistoriesForUser(Iterable<Issue> issues, ApplicationUser remoteUser) throws IllegalAccessException, InvocationTargetException { List<ChangeHistory> histories = changeHistoryManager.getChangeHistoriesForUser(issues, remoteUser); // index the change histories by issue return Multimaps.index(histories, new ByIssueIndexer()); }
public ChangelogBean build(Issue issue) { List<ChangeHistory> allChangeHistories = changeHistoryManager.getChangeHistoriesForUser(issue, authContext.getUser()); List<ChangelogBean.ChangeHistoryBean> histories = Lists.newArrayList(); for (ChangeHistory changeHistoryItem : allChangeHistories) { histories.add(makeChangeHistoryBean(changeHistoryItem)); } ChangelogBean changelog = new ChangelogBean(); changelog.setStartAt(0); changelog.setMaxResults(histories.size()); changelog.setTotal(histories.size()); changelog.setHistories(histories); return changelog; } }
@Override public List<IssueAction> getActions(Issue issue, ApplicationUser remoteUser) { boolean alwaysShowHeader = Boolean.valueOf(descriptor.getParams().get(ALWAYS_SHOW_HEADER)); List<ChangeHistory> allChangeHistories = changeHistoryManager.getChangeHistoriesForUser(issue, remoteUser); List<IssueAction> changeHistoryActions = Lists.newArrayListWithCapacity(allChangeHistories.size()); boolean first = true; changeHistoryActions.add(new IssueCreatedAction(descriptor, dateTimeFormatterFactory.formatter().forLoggedInUser(), userFormatManager, i18nHelper, avatarService, authenticationContext, issue)); for (ChangeHistory changeHistoryItem : allChangeHistories) { final HistoryMetadataManager.HistoryMetadataResult historyMetadata = historyMetadataManager.getHistoryMetadata(changeHistoryItem, remoteUser); boolean showHeader = first || alwaysShowHeader; changeHistoryActions.add(new ChangeHistoryAction(descriptor, changeHistoryItem, showHeader, attachmentManager, jiraDurationUtils, customFieldManager, dateTimeFormatterFactory.formatter().forLoggedInUser(), issue, changeLogHelper, historyMetadata.getHistoryMetadata(), historyMetadataRenderHelper)); first = false; } // This is a bit of a hack to indicate that there are no change history to display if (changeHistoryActions.isEmpty()) { IssueAction action = new GenericMessageAction(descriptor.getI18nBean().getText("viewissue.nochanges")); return Lists.newArrayList(action); } Collections.sort(changeHistoryActions, IssueActionComparator.COMPARATOR); return changeHistoryActions; }