@Override public IssueHistory next() { Issue nextIssue = issues.next(); List<ChangeHistory> nextChangeHistories = changeHistoryManager.getChangeHistoriesForUser(nextIssue, remoteUser); return new IssueHistory(nextIssue, ImmutableList.copyOf(nextChangeHistories)); }
public Collection<String> getOldIssueKeys(final String issueKey) { return changeHistoryManager.getPreviousIssueKeys(issueKey); } }
@Override public List<ChangeHistoryGroup> apply(final Issue issue) { final List<ChangeHistoryItem> changeHistoryItems = changeManager.getAllChangeItems(issue); return newArrayList(createChangeGroupsFromChangeItems(changeHistoryItems, issue)); }
public void clearChangeHistory(String issueKey) throws IssueNotFoundException{ IssueService.IssueResult result = issueService.getIssue(callingUser(), issueKey); if (!result.isValid()) { throw new IssueNotFoundException(result.getErrorCollection()); } changeHistoryManager.removeAllChangeItems(result.getIssue()); }
boolean createIssueLinkChangeItem(final String linkedIssueKey, final Issue issue) { final List<ChangeItemBean> linkChangeItemsForIssue = changeHistoryManager.getChangeItemsForField(issue, "Link"); // Run through all the change items for field Link and see if there is one for our key and if it has a corresponding // delete change item. We want to create the change item if: // * there is no reference to the link // * there is a reference to the link but there is also a reference to deleting the link boolean createItemFound = false; boolean deleteItemFound = false; for (ChangeItemBean changeItemBean : linkChangeItemsForIssue) { if (linkedIssueKey.equals(changeItemBean.getFrom())) { createItemFound = true; } else if (linkedIssueKey.equals(changeItemBean.getTo())) { deleteItemFound = true; } } return !createItemFound || deleteItemFound; }
@Override public Option<ChangeHistory> apply(@Nullable final Long input) { return Option.option(changeHistoryManager.getChangeHistoryById(input)); } };
public Set<Issue> find(final ActivityRequest request) { Collection<Project> projects = ImmutableSet.copyOf(getProjects(request)); if (projects.isEmpty()) { // If there are no projects then that means the user doesn't have permission to browse the requested project return ImmutableSet.of(); } return ImmutableSet.copyOf(changeHistoryManager.findUserHistory( authenticationContext.getLoggedInUser(), getUsers(request), projects, request.getMaxResults())); }
final Set<ApplicationUser> mentionedUsers = getMentionedUsers(mentionText, issue); final List<ChangeHistory> allChangeHistories = changeHistoryManager.getChangeHistories(issue); boolean containsDescriptionChanges = false; if(!allChangeHistories.isEmpty())
removeIssueLinks(user, issue); changeHistoryManager.removeAllChangeItems(issue); deleteMovedIssueKeyHistory(issue); removeIssueProperties(issue);
List<ChangeItemBean> assigneeHistory = getChangeHistoryManager().getChangeItemsForField(issue, "assignee");
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()); }
@SuppressWarnings("deprecation") public static Set<String> getAllIssueKeys(IssueManager issueManager, ChangeHistoryManager changeHistoryManager, Issue issue) { if (GET_ALL_ISSUE_KEYS_EXISTS) { return issueManager.getAllIssueKeys(issue.getId()); } else { Set<String> allIssueKeys = new HashSet<>(); if (issue != null) { // adding current issue key allIssueKeys.add(issue.getKey()); // Adding previous issue keys allIssueKeys.addAll(changeHistoryManager.getPreviousIssueKeys(issue.getId())); } return allIssueKeys; } }
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; }