I am upgrading a plugin to make it comptable with Jira 5.0.2.
The plugin will save the previous assignee to a custom field in issue in listener method.
The code is as follow:
Issue issue = event.getIssue(); String assigneeName = getPreviousAssigneeValue(event); customField.updateValue(null, issue, new ModifiedValue(issue.getCustomFieldValue(customField), assignee), new DefaultIssueChangeHolder());
The getPrevisouAssigneeValue(event) can return the correct User name as String type.
But the customField.updateValue does not work.
Can any body help me?
And the implementation of the customfield type is
public class PreviousAssigneeCFType extends ReadOnlyCFType { private final UserManager userMgr; public PreviousAssigneeCFType(UserManager userMgr, CustomFieldValuePersister customFieldValuePersister, StringConverter stringConverter, GenericConfigManager genericConfigManager) { super(customFieldValuePersister, stringConverter, genericConfigManager); this.userMgr = userMgr; } public String getSingularObjectFromString(final String string) throws FieldValidationException { return userMgr.getUser(string).getName(); } }
Thanks & Regards,
Yaoyu
Can you try this?
Issue issue = event.getIssue(); FieldLayoutManager fieldLayoutManager = ComponentAccessor.getFieldLayoutManager(); FieldLayoutItem fieldLayoutItem = fieldLayoutManager.getFieldLayout(issue).getFieldLayoutItem(customField); String assigneeName = getPreviousAssigneeValue(event); customField.updateValue(fieldLayoutItem, issue, new ModifiedValue(issue.getCustomFieldValue(customField), assignee), new DefaultIssueChangeHolder());
My plugin records the previous assignee of issue. now it works in issue, the previous assignee can be recorded.
But for search, the condition cannot search issue out. please help instruct which issue searcher should be configed.
The cftype java:
public class PreviousAssigneeCFType extends ReadOnlyCFType { private final UserManager userMgr; PreviousAssigneeCFType(CustomFieldValuePersister customFieldValuePersister, GenericConfigManager genericConfigManager, UserManager userMgr) { super(customFieldValuePersister, genericConfigManager); this.userMgr = userMgr; } public String getSingularObjectFromString(final String string) throws FieldValidationException { User user = userMgr.getUser(string); if(user!=null){ return user.getName(); } return ""; } }
The issue searcher config in atlassian.xml:
<customfield-searcher key="previous-assignee-searcher" name="Previous Assignee Searcher" class="com.atlassian.jira.issue.customfields.searchers.TextSearcher"> <description>Search for an issue's previous assignee</description> <resource type="velocity" name="label" location="templates/plugins/fields/view-searcher/label-searcher-basictext.vm" /> <resource type="velocity" name="search" location="templates/plugins/fields/edit-searcher/search-basictext.vm" /> <resource type="velocity" name="view" location="templates/plugins/fields/view-searcher/view-searcher-basictext.vm" /> <valid-customfield-type key="previous_assignee" /> </customfield-searcher>
neither TextSearcher nor UserPickerSearcher can work.
Please further help on this problem, how can I fix this plugin to support the customfield in issue search filter.
Thanks in advance,
Yaoyu
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
When you say the searcher don't work, what do you mean? Have you added the searcher for custom field?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.