public List getIssueKeysFromString(String body) { return JiraKeyUtils.getIssueKeysFromString(body); }
public String linkBugKeys(String body) { return JiraKeyUtils.linkBugKeys(body); }
public boolean isValid() { return JiraKeyUtils.validIssueKey(key); } }
while (util.match(getKeyMatcher().getIssueKeyRegex(), body)) final String key = createKeyFromMatchingGroups(matchGroups, match); if (isPartOfUrl(body, keyStart)) endIndex = getUrlEnd(body, match.beginOffset(2)); buff.append(getKeyMatcher().getLink(key));
@Override public boolean apply(final String projectKey) { return JiraKeyUtils.validProjectKey(projectKey); } }
public static List<String> getIssueKeysFromString(String body) { if (isBlank(body)) { return Collections.emptyList(); } final Perl5Util util = new Perl5Util(); //note that we have to create a new match, as MatchResult is not Threadsafe final List<String> result = new ArrayList<String>(); while (util.match(getKeyMatcher().getIssueKeyRegex(), body)) { final MatchResult match = util.getMatch(); // The issue key is composed of the all sub-pattern match // groups after the initial sub pattern match group final int matchGroups = match.groups(); // Check backs from the key to see if it part of the url & URL is ignored if (!getKeyMatcher().isIgnoreUrlWithKey() || !isPartOfUrl(body, match.beginOffset(2))) { result.add(createKeyFromMatchingGroups(matchGroups, match)); } body = body.substring(match.endOffset(matchGroups - 1)); } return Collections.unmodifiableList(result); }
final String issueKeyRegex = JiraKeyUtils.getIssueKeyRegex(); // this can be expensive, cache it locally while (util.match(issueKeyRegex, body)) if (JiraKeyUtils.isPartOfUrl(body, match.beginOffset(2)))
@EventListener public static void onApplicationPropertyChange(ApplicationPropertyChangeEvent event) { try { Map params = event.getParams(); ApplicationPropertyMetadata metadata = (ApplicationPropertyMetadata) params.get(ApplicationPropertyChangeEvent.KEY_METADATA); if (APKeys.JIRA_PROJECTKEY_PATTERN.equals(metadata.getKey())) { log.info("Resetting the issue key matcher"); JiraKeyUtils.resetKeyMatcher(); } } catch (Exception e) { log.error("Unable to decide whether to reset the project key matcher because the event doesn't seem to contain the correct metadata"); } } }
boolean isProjectKeyValid(final String key) { return JiraKeyUtils.validProjectKey(key); }
private static boolean isKeyInStringMatchingRegex(final String issueKey, String body) { final Perl5Util util = new Perl5Util(); //note that we have to create a new match, as MatchResult is not Threadsafe while (util.match(getKeyMatcher().getIssueKeyRegex(), body)) { final MatchResult match = util.getMatch(); // The issue key is composed of the all sub-pattern match // groups after the initial sub pattern match group final int matchGroups = match.groups(); final String key = createKeyFromMatchingGroups(matchGroups, match); if (issueKey.equals(key)) { // Check backs from the key to see if it part of the url & URL is ignored if (!getKeyMatcher().isIgnoreUrlWithKey() || !isPartOfUrl(body, match.beginOffset(2))) { return true; } } body = body.substring(match.endOffset(matchGroups - 1)); } return false; }
private static void clearStatics() { ComponentAccessor.initialiseWorker(null); DefaultOfBizConnectionFactory.getInstance().resetInstance(); JiraAuthenticationContextImpl.clearRequestCache(); while (RequestCacheController.isInContext()) { RequestCacheController.closeContext(); } DefaultIndexManager.flushThreadLocalSearchers(); JiraKeyUtils.resetKeyMatcher(); try { final Field field = Configuration.class.getDeclaredField("configurationImpl"); field.setAccessible(true); field.set(Configuration.class, null); } catch (NoSuchFieldException e) { throw new AssertionError(e); } catch (IllegalAccessException e) { throw new AssertionError(e); } }
public boolean validIssueKey(String key) { return JiraKeyUtils.validIssueKey(key); }
/** * Delegates to JiraKeyUtils to resolve issue keys from a String. Overrideable * for testing purposes (JiraKeyUtils is ugly to instantiate in a unit testing * environment) * * @param s String to search for issue keys * @return List of JIRA issue keys */ protected List<String> getIssueKeysFromString(String s) { return JiraKeyUtils.getIssueKeysFromString(s); }
public String render(String value, IssueRenderContext context) { return JiraKeyUtils.linkBugKeys(TextUtils.plainTextToHtml(value)); }
public boolean validProjectKey(String key) { return JiraKeyUtils.validProjectKey(key); }
public boolean isValidIssueKey(final String issueKey) { return JiraKeyUtils.validIssueKey(issueKey); }
Collection<String> getIssueKeysFromQuery(String query) { return JiraKeyUtils.getIssueKeysFromString(query); }
public int doEndTag() throws JspException { try { String body = bodyContent.getString(); bodyContent.clearBody(); // Provide the path so that links still work - even if the page is not requested by the "usual" URL final HttpServletRequest request = (HttpServletRequest) pageContext.getRequest(); bodyContent.getEnclosingWriter().write(JiraKeyUtils.linkBugKeys(body)); } catch (IOException e) { throw new JspException("IOException: " + e); } return super.doEndTag(); } }
if (validProjectKey(projectKey))
/** * Returns a project key of the project given issue belongs to. * * @param key issue key * @return The project key from an issue key, or null if the key is invalid * @deprecated Use {@link com.atlassian.jira.issue.IssueKey#from(String)} instead. Since v6.1. */ @Deprecated public static String getProjectKeyFromIssueKey(final String key) { if (!validIssueKey(key)) { return null; } return key.substring(0, key.lastIndexOf("-")); }