Package com.taskadapter.redmineapi.bean
Class Issue
- java.lang.Object
-
- com.taskadapter.redmineapi.bean.Issue
-
- All Implemented Interfaces:
FluentStyle,Identifiable
public class Issue extends java.lang.Object implements Identifiable, FluentStyle
Redmine's Issue.Note that methods returning lists of elements (like getRelations(), getWatchers(), etc return unmodifiable collections. You need to use methods like addRelations() if you want to add elements, e.g.:
issue.addRelations(Collections.singletonList(relation));
-
-
Field Summary
Fields Modifier and Type Field Description static Property<java.lang.Integer>ASSIGNEE_IDstatic Property<java.lang.String>ASSIGNEE_NAMEstatic Property<java.util.Set<Attachment>>ATTACHMENTSstatic Property<java.lang.Integer>AUTHOR_IDstatic Property<java.lang.String>AUTHOR_NAMEstatic Property<java.util.Set<Changeset>>CHANGESETSstatic Property<java.util.Set<Issue>>CHILDRENstatic Property<java.util.Date>CLOSED_ONstatic Property<java.util.Date>CREATED_ONstatic Property<java.util.Set<CustomField>>CUSTOM_FIELDScan't have two custom fields with the same ID in the collection, that's why it is declared as a Set, not a List.static Property<java.lang.Integer>DATABASE_IDstatic Property<java.lang.String>DESCRIPTIONstatic Property<java.lang.Integer>DONE_RATIOstatic Property<java.util.Date>DUE_DATEstatic Property<java.lang.Float>ESTIMATED_HOURSstatic Property<IssueCategory>ISSUE_CATEGORYstatic Property<java.util.Set<Journal>>JOURNALSstatic Property<java.lang.String>NOTESSome comment describing an issue update.static Property<java.lang.Integer>PARENT_IDstatic Property<java.lang.Integer>PRIORITY_IDstatic Property<java.lang.String>PRIORITY_TEXTstatic Property<java.lang.Boolean>PRIVATE_ISSUEstatic Property<java.lang.Boolean>PRIVATE_NOTESstatic Property<java.lang.Integer>PROJECT_IDstatic Property<java.lang.String>PROJECT_NAMEstatic Property<java.util.Set<IssueRelation>>RELATIONSstatic Property<java.lang.Float>SPENT_HOURSstatic Property<java.util.Date>START_DATEstatic Property<java.lang.Integer>STATUS_IDstatic Property<java.lang.String>STATUS_NAMEstatic Property<java.lang.String>SUBJECTstatic Property<Version>TARGET_VERSIONstatic Property<Tracker>TRACKERstatic Property<java.util.Date>UPDATED_ONstatic Property<java.util.Set<Watcher>>WATCHERS
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description IssueaddAttachment(Attachment attachment)IssueaddAttachments(java.util.Collection<Attachment> collection)IssueaddChangesets(java.util.Collection<Changeset> changesets)IssueaddChildren(java.util.Collection<Issue> children)IssueaddCustomField(CustomField customField)If there is a custom field with the same ID already present in the Issue, the new field replaces the old one.IssueaddCustomFields(java.util.Collection<CustomField> customFields)NOTE: The custom field(s) must have correct database ID set to be saved to Redmine.voidaddJournals(java.util.Collection<Journal> journals)Issue journals are created automatically when you update existing issues.IssueaddRelations(java.util.Collection<IssueRelation> collection)voidaddWatcher(int watcherId)IssueaddWatchers(java.util.Collection<Watcher> watchers)IssueclearCustomFields()Issuecreate(RequestParam... params)voiddelete()voiddeleteWatcher(int watcherId)booleanequals(java.lang.Object o)Issues are considered equal if their IDs are equal.java.lang.IntegergetAssigneeId()Redmine can be configured to allow group assignments for issues: Configuration option: Settings -> Issue Tracking -> Allow issue assignment to groupsjava.lang.StringgetAssigneeName()java.util.Collection<Attachment>getAttachments()Don't forget to use Include.attachments flag when loading issue from Redmine server:java.lang.IntegergetAuthorId()java.lang.StringgetAuthorName()IssueCategorygetCategory()java.util.Collection<Changeset>getChangesets()Don't forget to use Include.changesets flag when loading issue from Redmine server:java.util.Collection<Issue>getChildren()Don't forget to use Include.children flag when loading issue from Redmine server:java.util.DategetClosedOn()java.util.DategetCreatedOn()CustomFieldgetCustomFieldById(int customFieldId)CustomFieldgetCustomFieldByName(java.lang.String customFieldName)java.util.Collection<CustomField>getCustomFields()java.lang.StringgetDescription()java.lang.IntegergetDoneRatio()java.util.DategetDueDate()java.lang.FloatgetEstimatedHours()java.lang.IntegergetId()java.util.Collection<Journal>getJournals()Don't forget to use Include.journals flag when loading issue from Redmine server:java.lang.StringgetNotes()Deprecated.java.lang.IntegergetParentId()Parent Issue ID, or NULL for issues without a parent.java.lang.IntegergetPriorityId()java.lang.StringgetPriorityText()java.lang.IntegergetProjectId()java.lang.StringgetProjectName()java.util.Collection<IssueRelation>getRelations()Relations are only loaded if you include Include.relations when loading the Issue.java.lang.FloatgetSpentHours()java.util.DategetStartDate()java.lang.IntegergetStatusId()java.lang.StringgetStatusName()PropertyStoragegetStorage()java.lang.StringgetSubject()VersiongetTargetVersion()TrackergetTracker()java.util.DategetUpdatedOn()java.util.Collection<Watcher>getWatchers()Don't forget to use Include.watchers flag when loading issue from Redmine server:inthashCode()booleanisPrivateIssue()Default value is not determines.booleanisPrivateNotes()IssuesetAssigneeId(java.lang.Integer assigneeId)IssuesetAssigneeName(java.lang.String assigneeName)IssuesetAuthorId(java.lang.Integer id)Deprecated.IssuesetAuthorName(java.lang.String name)Deprecated.IssuesetCategory(IssueCategory category)IssuesetClosedOn(java.util.Date closedOn)IssuesetCreatedOn(java.util.Date createdOn)IssuesetDescription(java.lang.String description)IssuesetDoneRatio(java.lang.Integer doneRatio)IssuesetDueDate(java.util.Date dueDate)IssuesetEstimatedHours(java.lang.Float estimatedTime)IssuesetId(java.lang.Integer id)IssuesetNotes(java.lang.String notes)IssuesetParentId(java.lang.Integer parentId)IssuesetPriorityId(java.lang.Integer priorityId)voidsetPriorityText(java.lang.String priority)Deprecated.This method has no effect when creating issues on Redmine Server, so we might as well just delete it in the future releases.IssuesetPrivateIssue(boolean privateIssue)IssuesetPrivateNotes(boolean privateNotes)IssuesetProjectId(java.lang.Integer projectId)IssuesetProjectName(java.lang.String name)IssuesetSpentHours(java.lang.Float spentHours)IssuesetStartDate(java.util.Date startDate)IssuesetStatusId(java.lang.Integer statusId)IssuesetStatusName(java.lang.String statusName)IssuesetSubject(java.lang.String subject)IssuesetTargetVersion(Version version)IssuesetTracker(Tracker tracker)voidsetTransport(Transport transport)IssuesetUpdatedOn(java.util.Date updatedOn)java.lang.StringtoString()voidupdate(RequestParam... params)
-
-
-
Field Detail
-
DATABASE_ID
public static final Property<java.lang.Integer> DATABASE_ID
-
SUBJECT
public static final Property<java.lang.String> SUBJECT
-
START_DATE
public static final Property<java.util.Date> START_DATE
-
DUE_DATE
public static final Property<java.util.Date> DUE_DATE
-
CREATED_ON
public static final Property<java.util.Date> CREATED_ON
-
UPDATED_ON
public static final Property<java.util.Date> UPDATED_ON
-
DONE_RATIO
public static final Property<java.lang.Integer> DONE_RATIO
-
PARENT_ID
public static final Property<java.lang.Integer> PARENT_ID
-
PRIORITY_ID
public static final Property<java.lang.Integer> PRIORITY_ID
-
ESTIMATED_HOURS
public static final Property<java.lang.Float> ESTIMATED_HOURS
-
SPENT_HOURS
public static final Property<java.lang.Float> SPENT_HOURS
-
ASSIGNEE_ID
public static final Property<java.lang.Integer> ASSIGNEE_ID
-
ASSIGNEE_NAME
public static final Property<java.lang.String> ASSIGNEE_NAME
-
NOTES
public static final Property<java.lang.String> NOTES
Some comment describing an issue update.
-
PRIVATE_NOTES
public static final Property<java.lang.Boolean> PRIVATE_NOTES
-
PRIORITY_TEXT
public static final Property<java.lang.String> PRIORITY_TEXT
-
PROJECT_ID
public static final Property<java.lang.Integer> PROJECT_ID
-
PROJECT_NAME
public static final Property<java.lang.String> PROJECT_NAME
-
AUTHOR_ID
public static final Property<java.lang.Integer> AUTHOR_ID
-
AUTHOR_NAME
public static final Property<java.lang.String> AUTHOR_NAME
-
DESCRIPTION
public static final Property<java.lang.String> DESCRIPTION
-
CLOSED_ON
public static final Property<java.util.Date> CLOSED_ON
-
STATUS_ID
public static final Property<java.lang.Integer> STATUS_ID
-
STATUS_NAME
public static final Property<java.lang.String> STATUS_NAME
-
ISSUE_CATEGORY
public static final Property<IssueCategory> ISSUE_CATEGORY
-
PRIVATE_ISSUE
public static final Property<java.lang.Boolean> PRIVATE_ISSUE
-
CUSTOM_FIELDS
public static final Property<java.util.Set<CustomField>> CUSTOM_FIELDS
can't have two custom fields with the same ID in the collection, that's why it is declared as a Set, not a List.
-
RELATIONS
public static final Property<java.util.Set<IssueRelation>> RELATIONS
-
ATTACHMENTS
public static final Property<java.util.Set<Attachment>> ATTACHMENTS
-
-
Constructor Detail
-
Issue
public Issue()
-
Issue
public Issue(Transport transport, int projectId)
Each Issue object must have project Id set in order for Redmine 3.x to accept it via REST API.
-
Issue
public Issue(Transport transport, int projectId, java.lang.String subject)
- Parameters:
projectId- Each Issue object must have project Id set in order for Redmine 3.x to accept it via REST API.
-
-
Method Detail
-
getProjectId
public java.lang.Integer getProjectId()
-
setProjectId
public Issue setProjectId(java.lang.Integer projectId)
-
getProjectName
public java.lang.String getProjectName()
-
setProjectName
public Issue setProjectName(java.lang.String name)
-
setId
public Issue setId(java.lang.Integer id)
- Parameters:
id- database ID.
-
getDoneRatio
public java.lang.Integer getDoneRatio()
-
setDoneRatio
public Issue setDoneRatio(java.lang.Integer doneRatio)
-
getPriorityText
public java.lang.String getPriorityText()
-
setPriorityText
public void setPriorityText(java.lang.String priority)
Deprecated.This method has no effect when creating issues on Redmine Server, so we might as well just delete it in the future releases.
-
getAssigneeId
public java.lang.Integer getAssigneeId()
Redmine can be configured to allow group assignments for issues: Configuration option: Settings -> Issue Tracking -> Allow issue assignment to groupsAn assignee can be a user or a group
-
setAssigneeId
public Issue setAssigneeId(java.lang.Integer assigneeId)
-
getAssigneeName
public java.lang.String getAssigneeName()
-
setAssigneeName
public Issue setAssigneeName(java.lang.String assigneeName)
-
getEstimatedHours
public java.lang.Float getEstimatedHours()
-
setEstimatedHours
public Issue setEstimatedHours(java.lang.Float estimatedTime)
-
getSpentHours
public java.lang.Float getSpentHours()
-
setSpentHours
public Issue setSpentHours(java.lang.Float spentHours)
-
getParentId
public java.lang.Integer getParentId()
Parent Issue ID, or NULL for issues without a parent.- Returns:
- NULL, if there's no parent
-
setParentId
public Issue setParentId(java.lang.Integer parentId)
-
getId
public java.lang.Integer getId()
- Specified by:
getIdin interfaceIdentifiable- Returns:
- database id for this object. can be NULL for Issues not added to Redmine yet
-
getSubject
public java.lang.String getSubject()
-
setSubject
public Issue setSubject(java.lang.String subject)
-
getStartDate
public java.util.Date getStartDate()
-
setStartDate
public Issue setStartDate(java.util.Date startDate)
-
getDueDate
public java.util.Date getDueDate()
-
setDueDate
public Issue setDueDate(java.util.Date dueDate)
-
getAuthorId
public java.lang.Integer getAuthorId()
-
setAuthorId
@Deprecated public Issue setAuthorId(java.lang.Integer id)
Deprecated.Marking as "deprecated": according to Redmine REST API docs https://www.redmine.org/projects/redmine/wiki/Rest_Issues#Creating-an-issue , this parameter is not used when creating issues (January 2020).
-
getAuthorName
public java.lang.String getAuthorName()
-
setAuthorName
@Deprecated public Issue setAuthorName(java.lang.String name)
Deprecated.Marking as "deprecated": according to Redmine REST API docs https://www.redmine.org/projects/redmine/wiki/Rest_Issues#Creating-an-issue , this parameter is not used when creating issues (January 2020).
-
getTracker
public Tracker getTracker()
-
getDescription
public java.lang.String getDescription()
-
setDescription
public Issue setDescription(java.lang.String description)
-
getCreatedOn
public java.util.Date getCreatedOn()
-
setCreatedOn
public Issue setCreatedOn(java.util.Date createdOn)
-
getUpdatedOn
public java.util.Date getUpdatedOn()
-
setUpdatedOn
public Issue setUpdatedOn(java.util.Date updatedOn)
-
getClosedOn
public java.util.Date getClosedOn()
-
setClosedOn
public Issue setClosedOn(java.util.Date closedOn)
-
getStatusId
public java.lang.Integer getStatusId()
-
setStatusId
public Issue setStatusId(java.lang.Integer statusId)
-
getStatusName
public java.lang.String getStatusName()
-
setStatusName
public Issue setStatusName(java.lang.String statusName)
-
getCustomFields
public java.util.Collection<CustomField> getCustomFields()
- Returns:
- unmodifiable collection of Custom Field objects. the collection may be empty, but it is never NULL.
-
clearCustomFields
public Issue clearCustomFields()
-
addCustomFields
public Issue addCustomFields(java.util.Collection<CustomField> customFields)
NOTE: The custom field(s) must have correct database ID set to be saved to Redmine. This is Redmine REST API's requirement.
-
addCustomField
public Issue addCustomField(CustomField customField)
If there is a custom field with the same ID already present in the Issue, the new field replaces the old one.- Parameters:
customField- the field to add to the issue.
-
getNotes
@Deprecated public java.lang.String getNotes()
Deprecated.
-
setNotes
public Issue setNotes(java.lang.String notes)
- Parameters:
notes- Some comment describing the issue update
-
isPrivateNotes
public boolean isPrivateNotes()
-
setPrivateNotes
public Issue setPrivateNotes(boolean privateNotes)
- Parameters:
privateNotes- mark note as private
-
getJournals
public java.util.Collection<Journal> getJournals()
Don't forget to use Include.journals flag when loading issue from Redmine server:Issue issue = issueManager.getIssueById(3205, Include.journals);- Returns:
- unmodifiable collection of Journal entries or empty collection if no objects found. Never NULL.
- See Also:
Include.journals
-
addJournals
public void addJournals(java.util.Collection<Journal> journals)
Issue journals are created automatically when you update existing issues. journal entries are essentially log records for changes you make. you cannot just add log records without making actual changes. this API method is misleading and it should only be used internally by Redmine Json parser when parsing response from server. we should hide it from public. TODO hide this method. https://github.com/taskadapter/redmine-java-api/issues/199
-
getChangesets
public java.util.Collection<Changeset> getChangesets()
Don't forget to use Include.changesets flag when loading issue from Redmine server:Issue issue = issueManager.getIssueById(3205, Include.changesets);- Returns:
- unmodifiable collection of entries or empty collection if no objects found.
- See Also:
Include.changesets
-
getWatchers
public java.util.Collection<Watcher> getWatchers()
Don't forget to use Include.watchers flag when loading issue from Redmine server:Issue issue = issueManager.getIssueById(3205, Include.watchers);- Returns:
- unmodifiable collection of entries or empty collection if no objects found.
- See Also:
Include.watchers
-
getChildren
public java.util.Collection<Issue> getChildren()
Don't forget to use Include.children flag when loading issue from Redmine server:Issue issue = issueManager.getIssueById(3205, Include.children);- Returns:
- Collection of entries or empty collection if no objects found.
- See Also:
Include.children
-
equals
public boolean equals(java.lang.Object o)
Issues are considered equal if their IDs are equal. what about two issues with null ids?- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
getCustomFieldById
public CustomField getCustomFieldById(int customFieldId)
- Returns:
- the custom field with given Id or NULL if the field is not found
-
getCustomFieldByName
public CustomField getCustomFieldByName(java.lang.String customFieldName)
- Returns:
- the custom field with given name or NULL if the field is not found
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
getRelations
public java.util.Collection<IssueRelation> getRelations()
Relations are only loaded if you include Include.relations when loading the Issue.Issue issue = issueManager.getIssueById(3205, Include.relations);Since the returned collection is not modifiable, you need to use addRelations() method if you want to add elements, e.g.:
issue.addRelations(Collections.singletonList(relation));- Returns:
- unmodifiable collection of Relations or EMPTY collection if none found. Never returns NULL.
- See Also:
Include.relations
-
addRelations
public Issue addRelations(java.util.Collection<IssueRelation> collection)
-
getPriorityId
public java.lang.Integer getPriorityId()
-
setPriorityId
public Issue setPriorityId(java.lang.Integer priorityId)
-
getTargetVersion
public Version getTargetVersion()
-
getAttachments
public java.util.Collection<Attachment> getAttachments()
Don't forget to use Include.attachments flag when loading issue from Redmine server:Issue issue = issueManager.getIssueById(3205, Include.attachments);- Returns:
- unmodifiable collection of entries or empty collection if no objects found.
- See Also:
Include.attachments
-
addAttachments
public Issue addAttachments(java.util.Collection<Attachment> collection)
-
addAttachment
public Issue addAttachment(Attachment attachment)
-
getCategory
public IssueCategory getCategory()
-
setCategory
public Issue setCategory(IssueCategory category)
-
isPrivateIssue
public boolean isPrivateIssue()
Default value is not determines. it's up to the server what it thinks the default value is if not set.
-
setPrivateIssue
public Issue setPrivateIssue(boolean privateIssue)
-
getStorage
public PropertyStorage getStorage()
-
create
public Issue create(RequestParam... params) throws RedmineException
- Returns:
- the newly created Issue.
- Throws:
RedmineAuthenticationException- invalid or no API access key is used with the server, which requires authorization. Check the constructor arguments.NotFoundException- the required project is not foundRedmineException
-
update
public void update(RequestParam... params) throws RedmineException
- Throws:
RedmineException
-
delete
public void delete() throws RedmineException- Throws:
RedmineException
-
addWatcher
public void addWatcher(int watcherId) throws RedmineException- Throws:
RedmineException
-
deleteWatcher
public void deleteWatcher(int watcherId) throws RedmineException- Throws:
RedmineException
-
setTransport
public void setTransport(Transport transport)
- Specified by:
setTransportin interfaceFluentStyle
-
-