com.atlassian.jira.util
Class JiraKeyUtils

java.lang.Object
  extended by com.atlassian.jira.util.JiraKeyUtils

public class JiraKeyUtils
extends java.lang.Object


Nested Class Summary
static interface JiraKeyUtils.KeyMatcher
           
 
Field Summary
static java.lang.String STRIKE_THROUGH_CLOSED_KEYS
           
 
Constructor Summary
JiraKeyUtils()
           
 
Method Summary
static long getCountFromKey(java.lang.String key)
           
static long getFastCountFromKey(java.lang.String key)
          Same as getCountFromKey(String) except that is does not check for key validity
static java.lang.String getFastProjectKeyFromIssueKey(java.lang.String key)
          Same as getProjectKeyFromIssueKey(String) except that it does not check key validity
static java.lang.String getIssueKeyRegex()
           
static java.util.List<java.lang.String> getIssueKeysFromString(java.lang.String body)
           
static java.lang.String getProjectKeyFromIssueKey(java.lang.String key)
          Returns a project key of the project given issue belongs to.
static boolean isKeyInString(java.lang.String s)
          Determines whether any JIRA issue key is in the given string
static boolean isKeyInString(java.lang.String issueKey, java.lang.String body)
          Determines whether the provided key is part of the provided string
static boolean isPartOfUrl(java.lang.String body, int start)
           
static boolean isReservedKeyword(java.lang.String key)
          Check if the Project Key matches a list of reserved keywords - JRA-8051.
static java.lang.String linkBugKeys(java.lang.String body)
           
static boolean validIssueKey(java.lang.String key)
          Validates the given issue key.
static boolean validProjectKey(java.lang.String key)
          Validates the given project key and returns true if valid, false otherwise.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

STRIKE_THROUGH_CLOSED_KEYS

public static final java.lang.String STRIKE_THROUGH_CLOSED_KEYS
See Also:
Constant Field Values
Constructor Detail

JiraKeyUtils

public JiraKeyUtils()
Method Detail

validProjectKey

public static boolean validProjectKey(java.lang.String key)
Validates the given project key and returns true if valid, false otherwise.

Parameters:
key - project key to validate
Returns:
True if the supplied project key is valid

isReservedKeyword

public static boolean isReservedKeyword(java.lang.String key)
Check if the Project Key matches a list of reserved keywords - JRA-8051. For example, a folder named 'CON' cannot be created in WINDOWS as it is a reserved word.

This check is only enabled for WINDOWS machines at present as this issue has only been reported in the WINDOWS environment.

Parameters:
key - project key
Returns:
true if reserved word, false otherwise

getProjectKeyFromIssueKey

public static java.lang.String getProjectKeyFromIssueKey(java.lang.String key)
Returns a project key of the project given issue belongs to.

Parameters:
key - issue key
Returns:
The project key from an issue key, or null if the key is invalid

getFastProjectKeyFromIssueKey

public static java.lang.String getFastProjectKeyFromIssueKey(java.lang.String key)
Same as getProjectKeyFromIssueKey(String) except that it does not check key validity

Parameters:
key - issue key
Returns:
The project key from an issue key, or null if the key is invalid

getFastCountFromKey

public static long getFastCountFromKey(java.lang.String key)
Same as getCountFromKey(String) except that is does not check for key validity

Parameters:
key - issue key
Returns:
The issue count from an issue key, or -1 if the key is invalid

getCountFromKey

public static long getCountFromKey(java.lang.String key)
Parameters:
key - issue key
Returns:
The issue count from an issue key, or -1 if the key is invalid

validIssueKey

public static boolean validIssueKey(java.lang.String key)
Validates the given issue key.

Parameters:
key - issue key
Returns:
True if the supplied issue key starts with a valid project key, and ends with a number

isKeyInString

public static boolean isKeyInString(java.lang.String issueKey,
                                    java.lang.String body)
Determines whether the provided key is part of the provided string

Parameters:
issueKey - issue key
body - string to check
Returns:
true if the given key is in the body, false otherwise

isKeyInString

public static boolean isKeyInString(java.lang.String s)
Determines whether any JIRA issue key is in the given string

Parameters:
s - string to check
Returns:
true if a key was found, false otherwise

linkBugKeys

public static java.lang.String linkBugKeys(java.lang.String body)

getIssueKeysFromString

public static java.util.List<java.lang.String> getIssueKeysFromString(java.lang.String body)

isPartOfUrl

public static boolean isPartOfUrl(java.lang.String body,
                                  int start)

getIssueKeyRegex

public static java.lang.String getIssueKeyRegex()


Copyright © 2002-2010 Atlassian. All Rights Reserved.