Worklog Attribute Service
Timetracker version 4.7.5 or higher is required to access this API
JIRA Administrators or JIRA System Administrators permission required for the user this service
Timetracker worklog attributes can be managed via this Service:
Query worklog attributes
Add worklog attributes
Update worklog attributes
Delete worklog attributes
API
package org.everit.jira.reporting.service.attribute;
import java.util.List;
/**
* Public Worklog Attribute Service.
*/
public interface WorklogAttributeService {
/**
* Delete worklog attribute. Requires System Administrator or Administrator jira permission.
*
* @param worklogAttributeName
* the name of the worklog attribute.
*/
void deleteWorklogAttribute(final String worklogAttributeName);
/**
* List enabled worklog attribute names. Requires System Administrator or Administrator jira
* permission, else returns an empty list. Disabled attirbutes won't be returned.
*/
List<String> listWorklogAttributes();
/**
* Create or Update worklog attribute names. Requires System Administrator or Administrator jira permission.
*
* @param worklogAttributeNames
* the worklog attribute names.
*/
void updateWorklogAttributes(final List<String> worklogAttributeNames);
}
Example
Â
import com.onresolve.scriptrunner.runner.customisers.PluginModule;
import com.onresolve.scriptrunner.runner.customisers.WithPlugin;
import org.everit.jira.reporting.service.attribute.WorklogAttributeService;
import java.util.Arrays;
import java.util.List;
@WithPlugin("org.everit.jira.timetracker.plugin")
@PluginModule
WorklogAttributeService worklogAttributeService;
// list worklog attributes (only enabled attributes will be returned)
List<String> worklogAttributes = worklogAttributeService.listWorklogAttributes();
// log.info(worklogAttributes);
// add worklog attributes
worklogAttributeService.updateWorklogAttributes(Arrays.asList("billable", "not-billable"));
worklogAttributes = worklogAttributeService.listWorklogAttributes();
// log.info(worklogAttributes);
// delete worklog attribute
worklogAttributeService.deleteWorklogAttribute("billable");
worklogAttributes = worklogAttributeService.listWorklogAttributes();
// log.info(worklogAttributes);
// delete worklog attribute
worklogAttributeService.deleteWorklogAttribute("not-billable");
worklogAttributes = worklogAttributeService.listWorklogAttributes();
// log.info(worklogAttributes);
Â