@Override public String apply(final String projectKey) { return IssueKey.format(projectKey, issue.getNumber()); } }))
public static String format(final Project project, final long issueNumber) { return format(project.getKey(), issueNumber); }
/** * This is a sanity check to ensure that we are only giving out project keys that haven't already been given out. * <p> In an ideal world, this should never return true. </p> Note that this method isn't guaranteed to avoid * duplicates, as it will only work if the Issue has already been inserted in the DB. * * @param incCount the suggested Issue number * @param project The project * @return true if this Issue Key already exists in the DB. */ private boolean counterAlreadyExists(final long incCount, final Project project) throws GenericEntityException { final String issueKey = IssueKey.format(project, incCount); final boolean alreadyExists = issueManager.isExistingIssueKey(issueKey); if (alreadyExists) { log.warn("Existing issue found for key " + issueKey + ". Incrementing key."); } return (alreadyExists); }
private void initializeKey() { if (getProjectObject() != null && issueNumber != null) { key = IssueKey.format(getProjectObject(), issueNumber); } else { key = null; } }
/** * Helper method to mung an issue key to the given project key. * @param originalProjectKey The project key that the issue should be under. * @param issueKey The issue key to mung. * @return Munged issue key with the specified original project key as the issue prefix. */ public static String computeIssueKeyForOriginalProjectKey(final String originalProjectKey, final String issueKey) { final long issueNumber = IssueKey.from(issueKey).getIssueNumber(); return IssueKey.format(originalProjectKey, issueNumber); }
return IssueKey.format(project, issueNumber);
@Override @Nullable public File getAttachmentDirectory(@Nonnull final String issueKey) { final IssueKey ik = IssueKey.from(issueKey); final Project project = projectManager.getProjectObjByKey(ik.getProjectKey()); if (project != null) { return getAttachmentDirectory(getAttachmentDirName(), project.getOriginalKey(), IssueKey.format(project.getOriginalKey(), ik.getIssueNumber())); } return null; }
@Override public void recordMovedIssueKey(Issue oldIssue) { // Record the historical issue key under all historical keys for the project, for easy lookup later final Set<String> projectKeys = projectKeyStore.getProjectKeys(oldIssue.getProjectId()); for (final String projectKey : projectKeys) { String oldIssueKey = IssueKey.format(projectKey, oldIssue.getNumber()); movedIssueKeyStore.recordMovedIssueKey(oldIssueKey, oldIssue.getId()); } }