@com.adaptavist.hapi.cloud.analytics.CloudTracked class WorkItems extends java.lang.Object
An updated terminology utility class for managing work items (issues) in Jira Cloud.
WorkItems provides static methods that delegate to Issues, using updated
terminology. Every method in this class calls the corresponding method on Issues
under the hood, so behavior is identical.
Existing code using Issues continues to work unchanged. New code can use
WorkItems for updated terminology.
// Retrieve a work item by key
def workItem = WorkItems.getByKey("TEST-123")
println "Summary: ${workItem.summary"
println "Work Type: ${workItem.workType.name}"
// Create a new work item
def newWorkItem = WorkItems.create("SR", "Task") {
summary = "Implement feature X"
description = "Detailed description of feature X"
}
println "Created: ${newWorkItem.key}"
// Count work items matching a JQL query
def total = WorkItems.count("project = SR AND status = 'To Do'")
println "Total: $total"
// Search for work items
WorkItems.search("project = SR AND status = 'To Do'").each {
println "Work Item: ${it.key} - ${it.summary}"
}
}
| Constructor and description |
|---|
WorkItems() |
| Type Params | Return Type | Name and description |
|---|---|---|
|
static long |
count(java.lang.String jql)Returns the number of work items matching a JQL query. |
|
static WorkItem |
create(java.lang.String spaceKey, java.lang.String workTypeName, groovy.lang.Closure<?> specification)Creates a work item of a given type in a space found by space key. |
|
static WorkItem |
getByKey(java.lang.String key)Retrieves a work item by its key. |
|
static IssueIterator |
search(java.lang.String jql)Executes the JQL and returns matching work items. |
| Methods inherited from class | Name |
|---|---|
class java.lang.Object |
java.lang.Object#equals(java.lang.Object), java.lang.Object#getClass(), java.lang.Object#hashCode(), java.lang.Object#notify(), java.lang.Object#notifyAll(), java.lang.Object#toString(), java.lang.Object#wait(), java.lang.Object#wait(long), java.lang.Object#wait(long, int) |
Returns the number of work items matching a JQL query.
Delegates to Issues.count.
jql - a JQL queryCreates a work item of a given type in a space found by space key.
Delegates to Issues.create.
WorkItems.create('SR', 'Task') {
summary = 'Hello world'
}spaceKey - space key of the space to create the work item inworkTypeName - work type name for the work itemspecification - closure containing parameters to set on the created work itemRetrieves a work item by its key.
Delegates to Issues.getByKey.
key - the unique key of the work item (e.g., "SR-123")Executes the JQL and returns matching work items.
Delegates to Issues.search.
WorkItems.search('project = FOO').each {
println "Work Item: ${it.key - ${it.summary}"
}
}jql - a JQL query