How to delete a label from an issue?

Ashish Grover November 29, 2011

I am trying to add functionality in my plugin to remove a label from an issue.

Any help?

5 answers

1 accepted

0 votes
Answer accepted
Ashish Grover December 15, 2011

Create a new Set<String> that contains all but one label, that is the one to be deleted.

Call LabelManager.setLabel().

or use MutableIssue to use mutableIssue.setLabels(Set<Label>)

(i don't prefer this one)

0 votes
RambanamP
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 29, 2011

following way you can delete labels from issue

issue.getLabels();

it will return set of lables which are appended to issue from that set you can delete label if ur deleting one label you have to update remaining set using

issue.setLabels(setof labels);

if you are deleteing all labels then you have to set labels with empty set

let me know if have any question

cheers


Ashish Grover November 30, 2011

i cudnt find any issue.setLabes() method....however i gt came across LabelManager.setLabels()...however it takes Set<String> of label so i need to convert all labels i want to add to string

RambanamP
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 30, 2011

if you are using jira 4.4.1 then you should get that methods, you can find the API at

http://docs.atlassian.com/jira/4.4.1/com/atlassian/jira/issue/Issue.html

still if you have questions let me know

Ashish Grover December 12, 2011

sory fr d discontinuity...but dere were sm priority tasks at hand...

as i said.... i have d getLabels() method....but not setLabels(set)

rather i cudnt find any setter for Issue

RambanamP
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 12, 2011

Normally For Issue Object don't have any methods to set values. you have to use Mutable Issue to set values,

you can find that method at http://docs.atlassian.com/jira/4.4.1/com/atlassian/jira/issue/MutableIssue.html#setLabels(java.util.Set)

still if you have question let me know

0 votes
Ashish Grover November 29, 2011

currently m workin on jira 4.4.1

0 votes
Ashish Grover November 29, 2011

currently m workin on 4.1 but planning to shift to 4.4 soon

0 votes
RambanamP
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 29, 2011

which version of Jira you are using?

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events