|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjetbrains.buildServer.issueTracker.AbstractIssueProvider
public abstract class AbstractIssueProvider
Represents a default implementation of IssueProvider interface.
This class resolves related issues using pattern matching, and fetches them using
IssueFetcher.
Class doesn't use any cache (fetcher does).
| Field Summary | |
|---|---|
protected static java.util.regex.Pattern |
EMPTY_PATTERN
|
protected org.apache.commons.httpclient.Credentials |
myCredentials
|
protected IssueFetcher |
myFetcher
|
protected java.lang.String |
myHost
|
protected java.util.regex.Pattern |
myPattern
|
protected java.util.Map<java.lang.String,java.lang.String> |
myProperties
|
protected java.lang.String |
myType
|
| Fields inherited from interface jetbrains.buildServer.issueTracker.IssueProvider |
|---|
SECURE_PROPERTY_PREFIX |
| Constructor Summary | |
|---|---|
protected |
AbstractIssueProvider(java.util.regex.Pattern pattern,
IssueFetcher fetcher)
|
|
AbstractIssueProvider(java.lang.String type,
IssueFetcher fetcher)
|
| Method Summary | |
|---|---|
protected java.lang.String |
checkIssueIdBeforeTestConnection(java.lang.String issueId)
|
protected static java.util.regex.Pattern |
compileDisjunction(java.lang.String prefixes,
java.lang.String suffix)
Given a string containing the prefixes, composes the reg.exp pattern that accepts any of them plus suffix. |
protected java.util.regex.Pattern |
compilePattern(java.util.Map<java.lang.String,java.lang.String> properties)
Helper methods. |
void |
dispose()
Disposes the provider (releases all necessary resources, dumps caches on disk, etc). |
protected java.lang.String |
extractId(java.lang.String match)
|
IssueData |
findIssueById(java.lang.String id)
Returns the issue by the specified id. |
java.util.Map<java.lang.String,IssueData> |
findIssuesByIds(java.util.Collection<java.lang.String> ids)
Finds and returns the specified collection of issue ids. |
protected java.util.Map<java.lang.String,IssueData> |
findIssuesByIdsImpl(java.util.Collection<java.lang.String> ids)
|
IssueData |
findPossiblyExpiredIssue(java.lang.String id)
Returns the issue data corresponding to the id. |
CommentTransformationHelper |
getCommentTransformationHelper()
Returns the instance of helper class to support comment transformation (i.e. |
java.lang.String |
getConfigurationSummary()
Returns the basic summary of current configuration, for instance, "Jira" provider might return: "Projects: P1, P2". |
java.util.Map<java.lang.String,java.lang.String> |
getProperties()
Returns the map of provider properties. |
PropertiesProcessor |
getPropertiesProcessor()
Returns the properties processor instance (validator). |
java.util.Collection<IssueMention> |
getRelatedIssues(java.lang.String comment)
Returns the collection of issues related, or mentioned in the comment. |
java.util.Collection<IssueMention> |
getRelatedIssues(VcsModification modification)
Returns the collection of issues related to a modification. |
IssueTestConnectionSupport |
getTestConnectionSupport()
Returns the test connection support. |
java.lang.String |
getType()
Returns the type of this provider (the type of the corresponding factory). |
boolean |
isBatchFetchSupported()
Returns whether the issue provider supports fetching in batch. |
boolean |
isFetched(java.lang.String id)
Returns whether the issue is fetched and can be efficiently returned using IssueProvider.findIssueById(String) method. |
boolean |
isHasRelatedIssues(java.lang.String comment)
Returns whether there are related issues in the specified comment. |
boolean |
isHasRelatedIssues(VcsModification modification)
Returns whether there are related issues in the specified modification. |
protected static java.util.regex.Pattern |
safeCompile(java.lang.String pattern)
The same as Pattern.compile(pattern), but returns an empty pattern if
the provided pattern is incorrect. |
protected java.lang.String |
sanitizeHost(java.lang.String host)
|
void |
setProperties(java.util.Map<java.lang.String,java.lang.String> map)
Sets the provider properties (see IssueProvider.getProperties() method for the details). |
java.lang.String |
toString()
|
protected boolean |
useIdPrefix()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected static final java.util.regex.Pattern EMPTY_PATTERN
protected final java.lang.String myType
protected java.lang.String myHost
protected org.apache.commons.httpclient.Credentials myCredentials
protected java.util.regex.Pattern myPattern
protected java.util.Map<java.lang.String,java.lang.String> myProperties
protected final IssueFetcher myFetcher
| Constructor Detail |
|---|
public AbstractIssueProvider(@NotNull
java.lang.String type,
@NotNull
IssueFetcher fetcher)
protected AbstractIssueProvider(@NotNull
java.util.regex.Pattern pattern,
@NotNull
IssueFetcher fetcher)
| Method Detail |
|---|
@NotNull public java.lang.String getType()
IssueProvider
getType in interface IssueProvider
@NotNull
public java.util.Collection<IssueMention> getRelatedIssues(@NotNull
java.lang.String comment)
IssueProvidercomment
contains the substring that matches a certain pattern), or by any way the plugin chooses.
getRelatedIssues in interface IssueProvidercomment - the comment
IssueProvider.isHasRelatedIssues(String)
public boolean isHasRelatedIssues(@NotNull
java.lang.String comment)
IssueProvidercomment.
The relation can be defined by a mention in the text (a mention means that comment
contains the substring that matches a certain pattern), or by any way the plugin chooses.
isHasRelatedIssues in interface IssueProvidercomment - the comment
IssueProvider.getRelatedIssues(String)
@NotNull
public java.util.Collection<IssueMention> getRelatedIssues(@NotNull
VcsModification modification)
IssueProvider
getRelatedIssues in interface IssueProvidermodification - VCS modification
IssueProvider.isHasRelatedIssues(jetbrains.buildServer.vcs.VcsModification)
public boolean isHasRelatedIssues(@NotNull
VcsModification modification)
IssueProvidermodification.
In most cases the relation is defined via mentioning the issue id in the modification comment,
but could also be some extra field in VCS commit.
isHasRelatedIssues in interface IssueProvidermodification - a VCS modification
IssueProvider.getRelatedIssues(jetbrains.buildServer.vcs.VcsModification)
public boolean isFetched(@NotNull
java.lang.String id)
SIssueProviderIssueProvider.findIssueById(String) method.
isFetched in interface SIssueProviderid - the issue id
public IssueData findPossiblyExpiredIssue(@NotNull
java.lang.String id)
SIssueProviderid.
The main difference from IssueProvider.findIssueById(String) method is that method must be always
fast (should use only cached data) and the result data isn't expected to be up-to-date. So this
method should return the issue data if by chance it can be retrieved fast, even if a provider
consideres it out-dated and IssueProvider.findIssueById(String) method would make an extra call
to the issue-tracking system.
The simpliest (100% legal) implementation of this method:
public IssueData findPossiblyExpiredIssue(@NotNull String id) {
return null;
}
This way TeamCity will always show 'Retrieving...' message, when the issue isn't fetched
(see SIssueProvider.isFetched(String)).
findPossiblyExpiredIssue in interface SIssueProviderid - the issue id
null if the it cannot be returned efficiently
@Nullable
public IssueData findIssueById(@NotNull
java.lang.String id)
IssueProvider
The implementors are encouraged to report retrieving errors by throwing
RetrieveIssueException, rather than
simply return null:
NotFoundException when the issue cannot
be found, UnsupportedException when
the issue tracker protocol is not supported, etc.
findIssueById in interface IssueProviderid - issue id
null if the issue cannot be retrievedpublic boolean isBatchFetchSupported()
IssueBatchProviderSupportNote: the method is always fast.
isBatchFetchSupported in interface IssueBatchProviderSupport
@Nullable
public java.util.Map<java.lang.String,IssueData> findIssuesByIds(@NotNull
java.util.Collection<java.lang.String> ids)
IssueBatchProviderSupportnull is returned.
Note: the method is not necesserily fast, and should be called in a separate issue.
findIssuesByIds in interface IssueBatchProviderSupportids - the collection of issue ids to fetch
issue id -> issue data, or null@NotNull public java.util.Map<java.lang.String,java.lang.String> getProperties()
IssueProviderThe keys should consist of alphanumeric characters and start with a letter.
getProperties in interface IssueProvider
public void setProperties(@NotNull
java.util.Map<java.lang.String,java.lang.String> map)
IssueProviderIssueProvider.getProperties() method for the details).
Few words about thread-safety: properties can be changed from the admin UI, or in config file. By any of these events this method is called (synchronously). Hence this method should lock any other API method.
setProperties in interface IssueProvidermap - a properties mapIssueProvider.getProperties()public void dispose()
IssueProvider
dispose in interface IssueProviderpublic CommentTransformationHelper getCommentTransformationHelper()
IssueProvider
getCommentTransformationHelper in interface IssueProvider@NotNull public PropertiesProcessor getPropertiesProcessor()
SIssueProvider
It is guaranteed that IssueProvider.setProperties(java.util.Map) method is called only if
the processor finds no errors.
getPropertiesProcessor in interface SIssueProvider@NotNull public IssueTestConnectionSupport getTestConnectionSupport()
SIssueProvider
getTestConnectionSupport in interface SIssueProviderpublic java.lang.String getConfigurationSummary()
SIssueProvider"Projects: P1, P2".
getConfigurationSummary in interface SIssueProviderpublic java.lang.String toString()
toString in class java.lang.Object
@NotNull
protected java.util.regex.Pattern compilePattern(@NotNull
java.util.Map<java.lang.String,java.lang.String> properties)
protected boolean useIdPrefix()
@NotNull
protected java.lang.String extractId(@NotNull
java.lang.String match)
@Nullable
protected java.util.Map<java.lang.String,IssueData> findIssuesByIdsImpl(@NotNull
java.util.Collection<java.lang.String> ids)
@NotNull
protected java.lang.String sanitizeHost(@NotNull
java.lang.String host)
@Nullable
protected java.lang.String checkIssueIdBeforeTestConnection(@NotNull
java.lang.String issueId)
@NotNull
protected static java.util.regex.Pattern compileDisjunction(@NotNull
java.lang.String prefixes,
@NotNull
java.lang.String suffix)
prefixes = "foo bar"; suffix = "-\\d+"; result = "(foo|bar)-\\d+"
Prefixes are separated by ' ', '\t', '\n', '\r', ',', ';' characters.
prefixes - the prefixes (in one string)suffix - the suffix
@NotNull
protected static java.util.regex.Pattern safeCompile(@NotNull
java.lang.String pattern)
Pattern.compile(pattern), but returns an empty pattern if
the provided pattern is incorrect. In this case the issue provider will be disabled.
The pattern that matches empty string is considered incorrect.
pattern - the pattern to compile
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||