public abstract class TaskRepository
extends java.lang.Object
Tag
annotation to make it persistent.TaskRepositoryType
,
BaseRepository
Modifier and Type | Class and Description |
---|---|
static class |
TaskRepository.CancellableConnection |
Modifier and Type | Field and Description |
---|---|
static int |
BASIC_HTTP_AUTHORIZATION |
static int |
LOGIN_ANONYMOUSLY |
protected java.lang.String |
myCommitMessageFormat |
protected boolean |
myShouldFormatCommitMessage |
static int |
NATIVE_SEARCH
Supporting this feature means that server implements some kind of issues filtering.
|
protected static int |
NO_FEATURES |
static int |
STATE_UPDATING |
static int |
TIME_MANAGEMENT |
static java.util.regex.Pattern |
TIME_SPENT_PATTERN |
Modifier | Constructor and Description |
---|---|
|
TaskRepository() |
protected |
TaskRepository(TaskRepository other) |
|
TaskRepository(TaskRepositoryType type) |
Modifier and Type | Method and Description |
---|---|
abstract TaskRepository |
clone() |
TaskRepository.CancellableConnection |
createCancellableConnection()
Returns an object that can test connection.
|
boolean |
equals(java.lang.Object o) |
abstract java.lang.String |
extractId(java.lang.String taskName)
Attempts to extract server ID of the issue from the ID of local task (probably restored from project settings).
|
abstract Task |
findTask(java.lang.String id) |
java.util.Set<CustomTaskState> |
getAvailableTaskStates(Task task)
Retrieve states available for task from server.
|
java.lang.String |
getComment() |
java.lang.String |
getCommitMessageFormat() |
protected int |
getFeatures() |
javax.swing.Icon |
getIcon() |
Task[] |
getIssues(java.lang.String query,
int offset,
int limit,
boolean withClosed)
Retrieve tasks from server using its own pagination capabilities and also filtering out closed issues.
|
Task[] |
getIssues(java.lang.String query,
int offset,
int limit,
boolean withClosed,
ProgressIndicator cancelled) |
Task[] |
getIssues(java.lang.String query,
int max,
long since)
Deprecated.
To be removed in IDEA 14. Use
getIssues(String, int, int, boolean) instead. |
abstract CustomTaskState |
getPreferredCloseTaskState()
Task state that was used last time when closing task.
|
abstract CustomTaskState |
getPreferredOpenTaskState()
Task state that was used last time when opening task.
|
java.lang.String |
getPresentableName() |
TaskRepositoryType |
getRepositoryType() |
java.lang.String |
getTaskComment(Task task) |
java.lang.String |
getUrl()
URL of the server to be used in requests.
|
void |
initializeRepository()
This is invoked right after setting state.
|
boolean |
isConfigured() |
boolean |
isShared()
Shared repositories will be visible in visible in other projects, but only their URL will be initialized there.
|
boolean |
isShouldFormatCommitMessage() |
boolean |
isSupported(int feature) |
void |
setCommitMessageFormat(java.lang.String commitMessageFormat) |
abstract void |
setPreferredCloseTaskState(CustomTaskState state)
Remember state used when closing task most recently.
|
abstract void |
setPreferredOpenTaskState(CustomTaskState state)
Remember state used when opening task most recently.
|
void |
setRepositoryType(TaskRepositoryType type) |
void |
setShared(boolean shared) |
void |
setShouldFormatCommitMessage(boolean shouldFormatCommitMessage) |
void |
setTaskState(Task task,
CustomTaskState state)
Update state of the task on server.
|
void |
setTaskState(Task task,
TaskState state)
Deprecated.
Use
setTaskState(Task, CustomTaskState) instead. |
void |
setUrl(java.lang.String url) |
void |
testConnection()
Deprecated.
use #createCancellableConnection()
|
java.lang.String |
toString() |
void |
updateTimeSpent(LocalTask task,
java.lang.String timeSpent,
java.lang.String comment) |
protected static final int NO_FEATURES
public static final int BASIC_HTTP_AUTHORIZATION
public static final int LOGIN_ANONYMOUSLY
public static final int TIME_MANAGEMENT
public static final int STATE_UPDATING
public static final int NATIVE_SEARCH
query
parameter from getIssues(java.lang.String, int, long)
} method, otherwise they will
be filtered internally in TaskManager.getIssues(java.lang.String)
.public static final java.util.regex.Pattern TIME_SPENT_PATTERN
protected boolean myShouldFormatCommitMessage
protected java.lang.String myCommitMessageFormat
public TaskRepository()
public TaskRepository(TaskRepositoryType type)
protected TaskRepository(TaskRepository other)
public java.lang.String getUrl()
getPresentableName()
.getPresentableName()
public void setUrl(java.lang.String url)
public boolean isConfigured()
public boolean isShared()
public void setShared(boolean shared)
public java.lang.String getPresentableName()
public javax.swing.Icon getIcon()
@Deprecated public void testConnection() throws java.lang.Exception
java.lang.Exception
public TaskRepository.CancellableConnection createCancellableConnection()
CancellableRunnable.cancel()
should cancel the process.null
if not supported@Deprecated public Task[] getIssues(java.lang.String query, int max, long since) throws java.lang.Exception
getIssues(String, int, int, boolean)
instead.NATIVE_SEARCH
feature, tasks returned MUST be filtered by specified query.query
- repository specific.max
- maximum issues number to returnsince
- last updated timestamp. If 0, all issues should be returned.java.lang.Exception
public Task[] getIssues(java.lang.String query, int offset, int limit, boolean withClosed) throws java.lang.Exception
query
- arbitrary search query, possibly provided by user for search. It may utilize server specific query language.offset
- index of the first issue to returnlimit
- maximum number of issues returned by server in this request (or number of issues per page in some interpretations)withClosed
- whether to include closed (e.g. fixed/resolved) issues to responsejava.lang.Exception
public Task[] getIssues(java.lang.String query, int offset, int limit, boolean withClosed, ProgressIndicator cancelled) throws java.lang.Exception
java.lang.Exception
public java.util.Set<CustomTaskState> getAvailableTaskStates(Task task) throws java.lang.Exception
setTaskState(Task, TaskState)
.task
- task to updatejava.lang.Exception
public abstract void setPreferredOpenTaskState(CustomTaskState state)
public abstract CustomTaskState getPreferredOpenTaskState()
public abstract void setPreferredCloseTaskState(CustomTaskState state)
public abstract CustomTaskState getPreferredCloseTaskState()
public abstract Task findTask(java.lang.String id) throws java.lang.Exception
id
- task ID. Don't forget to define extractId(String)
, if your server uses not PROJECT-123 format for task IDs.null
otherwise. Basically you should return null
on e.g. 404 error and throw exception with
information about failure in other cases.java.lang.Exception
public abstract TaskRepository clone()
clone
in class java.lang.Object
public abstract java.lang.String extractId(java.lang.String taskName)
null
,
this repository is attached to that local task and is used then to refresh it via findTask(String)
,
update its state via setTaskState(Task, CustomTaskState)
, etc. Because the decision is based only on syntactic
structure of ID, this approach works poorly in case of several repositories with similar issue IDs, e.g. JIRA and YouTrack,
and so it's a subject of change in future.taskName
- ID of the task to checknull
if it doesn't look like issue ID of this tracker@Deprecated public void setTaskState(Task task, TaskState state) throws java.lang.Exception
setTaskState(Task, CustomTaskState)
instead.java.lang.Exception
public void setTaskState(Task task, CustomTaskState state) throws java.lang.Exception
getAvailableTaskStates(Task)
will be passed here.
Don't forget to add STATE_UPDATING
in getFeatures()
and supported states in getAvailableTaskStates(Task)
.task
- issue to updatestate
- new state of the issuejava.lang.Exception
TaskRepositoryType.getPossibleTaskStates()
,
getFeatures()
public void initializeRepository()
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public final TaskRepositoryType getRepositoryType()
public final void setRepositoryType(TaskRepositoryType type)
public boolean isShouldFormatCommitMessage()
public void setShouldFormatCommitMessage(boolean shouldFormatCommitMessage)
public java.lang.String getCommitMessageFormat()
public void setCommitMessageFormat(java.lang.String commitMessageFormat)
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String getTaskComment(Task task)
public java.lang.String getComment()
public void updateTimeSpent(LocalTask task, java.lang.String timeSpent, java.lang.String comment) throws java.lang.Exception
timeSpent
- time in TIME_SPENT_PATTERN
formatjava.lang.Exception
public boolean isSupported(int feature)
protected int getFeatures()